sure, the IN and NOT IN clauses are much faster than using multiple ANDs,
but don't transfer the load to CF - allow the DB to do what it's best at...

<cfquery name=qCrop datasource="common_as">
SELECT DISTINCT Description 
FROM    VCT 
WHERE   description NOT IN ('ANISE','APPLES','ASPARAGUS','BEETS','BROCCOLI')
ORDER BY Description
</cfquery>

+-----------------------------------------------+
Bryan Love
  Database Analyst
  Macromedia Certified Professional
  Internet Application Developer
TeleCommunication Systems
[EMAIL PROTECTED]
+-----------------------------------------------+

"...'If there must be trouble, let it be in my day, that my child may have
peace'..."
        - Thomas Paine, The American Crisis

"Let's Roll"
        - Todd Beamer, Flight 93



-----Original Message-----
From: Jillian Carroll [mailto:[EMAIL PROTECTED]
Sent: Wednesday, June 11, 2003 11:37 AM
To: CF-Talk
Subject: SOT: SQL Question - Could CF make this easier?


I am creating a drop-down list of items, but I want to keep several items
from appearing in the drop-down.

Is there a more efficient way to accomplish this (there will be several more
exclusions):

<cfquery name=qCrop datasource="common_as">
SELECT DISTINCT 
        Description 
FROM    VCT 
ORDER BY 
        Description
WHERE   description != 'ANISE'
        AND description != 'APPLES'
        AND description != 'ASPARAGUS'
        AND description != 'BEETS'
        AND description != 'BROCCOLI'
</cfquery>

--
Jillian



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription: 
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq

This list and all House of Fusion resources hosted by CFHosting.com. The place for 
dependable ColdFusion Hosting.
http://www.cfhosting.com

                                Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
                                

Reply via email to