Table1 is Engine and Road Number
Table2 is Engine and SomeColumn

Psuedo Code:
<cfquery>
     select table2.engine
     from table2
     where table2.engine not in (select engine from table1)
<cfquery>

Then display the results.


The logic can be reversed as well.
CC





JB Mentzer <[EMAIL PROTECTED]> on 06/06/2001 01:04:00 PM

Please respond to [EMAIL PROTECTED]

To:   CF-Talk <[EMAIL PROTECTED]>
cc:
Subject:  How to query whats *not* in the database?


Hi all

I've got a table that drives an image gallery of railroad steam
locomotives. Each engine has a road number between 800 and 844. The
table currently consists of 68 records of 25 engines. So, 20 aren't
represented in my archive. What I'd like to do is display a list of
engines (aka "road numbers") that don't appear in the table.

My first guess was to loop over a query 45 times. When the
query.recordcount EQ 0, I'd <CFIF> the road_no into an array. Then I'd
display the array.

I'm thinking looping over a query would be slow. What would be a faster
way to do this? How would you solve this?

Thanks!

* john *
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm

Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to