How about something like this.

<cfset trainlist = "">
<cfloop query="gettrains">
 <cfset trainlist = ListAppend(trainlist, #trainnum#)>
</cfloop>
<cfloop index="ii" from="800" to="844">
 <cfoutput>
 <cfif #trainlist# DOES NOT CONTAIN #ii#>
   #ii#<br>
 </cfif>
 </cfoutput>
</cfloop>


Richard Ramos
Network Administrator
Softitler Net, Inc.
www.softitler.com
[EMAIL PROTECTED]

----- Original Message -----
From: "JB Mentzer" <[EMAIL PROTECTED]>
To: "CF-Talk" <[EMAIL PROTECTED]>
Sent: Wednesday, June 06, 2001 11:04 AM
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