You could try something like

<cfquery name="combined" dbtype="query">
   SELECT firstName, lastName
   FROM query1
   WHERE NOT EXISTS (
      SELECT firstName, lastName
      FROM query2
      WHERE firstName = query1.firstName
      AND lastName = query1.lastName
   )
</cfquery>

No guarantees - this is standard SQL and would work with MySQL, but I'm not 
sure it will work with a query-of-queries.

Matt

> hi andy
> 
> query 1 has 2 columns firstName and lastName
> 
> then i want to query the database to ensure that each firstName and 
> lastName combination exists in the database, if not then i want it to 
> return me a list of those that dont.
> 
> i have achieved this through a loop but i am thinking there must be a 
> quicker way of doing this directly in a cfquery, as it is taking too 
> long when there are thousands of names it has to check
> 
> thanks 


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;192386516;25150098;k

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:303908
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

Reply via email to