Try

SELECT
        [column list]
FROM
        [table]
WHERE
        catid LIKE '#ID#' 
OR
        catid LIKE '#ID#,%' 
OR
        catid LIKE '%,#ID#' 
OR
        catid LIKE '%,#ID#,%' 


Not the best solution in the world, but should cover the combinations of
commas and ids.

.......................
Ben Nadel 
Web Developer
Nylon Technology
350 7th Ave.
Suite 1005
New York, NY 10001
212.691.1134 x 14
212.691.3477 fax
www.nylontechnology.com

Sanders: Lightspeed too slow?
Helmet: Yes we'll have to go right to ludacris speed.
-----Original Message-----
From: Patrick Forsythe [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, April 05, 2006 12:50 PM
To: CF-Talk
Subject: help with list values in db

I need some help comparing a value to a list of values in a database.
Database is sql server coldfusion is mx.

I have many hundreds of thousands of records is this database and one column
is a catid field it can be a single number or it can be a list of numbers,
i.e., 3,4,51.

The problem I am having is that I am trying to pull all the records that are
in a category. so i want all the records that have a catid of 5 or that have
5 in their list of records i.e., 4,5,51

and this is where I am having a problem my query will pick out all the 5's
but ignore the ones that have multiple entries i.e.,4,5,23 that record would
not get added into my query.

Any help would be grately appreciated.

--
Patrick Forsythe
Tech Support
Smallville Communications
http://www.toto.net




~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Message: http://www.houseoffusion.com/lists.cfm/link=i:4:237024
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