Say I have two simple queries:

<cfquery name="getCustsFromCusts" datasource="#DSN#">
SELECT CustID
FROM    Customers
</cfquery>

[and that query returns 700 records.]

<cfquery name="getCustsFromOrders" datasource="#DSN#">
SELECT CustID
FROM    Orders
</cfquery>

[and that query returns 500 records.]

The first query gets all Customer IDs. The second query gets all Csutomer
IDs that have placed orders. Is there some way in SQL, to combine these two
queries into one and return only the Customer IDs that are in the
'Customers' table that ARE NOT in the 'Orders' table. Using this example,
200 records would be returned.


Any help would be appreciated.
Che


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Special thanks to the CF Community Suite Gold Sponsor - CFHosting.net
http://www.cfhosting.net

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:185681
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to