You could create a SPROC to do it like this.
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO
CREATE PROCEDURE getDescriptions()
AS
SET NOCOUNT ON
SELECT DISTINCT
description
FROM vct
WHERE description
NOT IN (
'ANISE', 'APPLES', 'ASPARAGUS', 'BEETS', 'BROCCOLI'
)
ORDER BY
description
END
GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO
----- Original Message -----
From: "Bryan Love" <[EMAIL PROTECTED]>
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
Get the mailserver that powers this list at
http://www.coolfusion.com
Unsubscribe:
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4