As you've realized, SQL is not inherently designed for this problem.  There
may be a workaround but it would be (I think) product-dependent.  What's the
database engine?

-----Original Message-----
From: Paul Sinclair [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, June 13, 2001 10:17 AM
To: CF-Talk
Subject: SQL: Comparing value against a list of values


I have a table with a field that contains a comma delimited list of values,
such as:

10,11,21,100

In doing a <cfquery> against the table, I want to select records where one
or more of the values in this list of values matches a value in the WHERE
clause of my sql query. For example:

select *
from tbl
where csvList = '%1%'

The problem is that the above select statement will select ANY record that
has '1' in the field no matter what the "true" values in the field are
(i.e., 1 is "LIKE" 10,11,21,100).

How do I make the select query compare '1' against '10', and '1' against
'11' and '1' against '21', and '1' against '100'.

Thank you for help.

Regards,
Paul Sinclair
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
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