If you don't want to change the DB design you could try:

SELECT *
FROM YourTable
WHERE YourColumn LIKE '%,#YourVariable#,%'
OR YourColumn LIKE '#YourVariable#,%'
OR YourColumn LIKE '%,#YourVariable#'

Given a values like:

1,2,3,7,4,5,6
7,1,2,3,4,5,6
1,2,3,4,5,6,7

Looking for 7 it should match all three. Which seems like overkill, but
looks like it'd work.

Now I'm sure there might be a better way to do this. Personally I'd change
the table design.

Adrian

-----Original Message-----
From: Eric J. Hoffman [mailto:[EMAIL PROTECTED]
Sent: 07 February 2006 02:01
To: CF-Talk
Subject: Query finding data IN


Have a query here I am not sure how to find the answer....

Have a field in the database with a comma list of items...and want it to
only pull a record based upon a session variable that is a single integer.

So how do I say give me records where database field(comma delimited)
contains session variable?

example:

Where table.sites HAS session.variable ....I know has isn't the right term,
but this is the english of it.

Thanks.
--------------------------------------------------------


Eric J. Hoffman
Managing Partner
2081 Industrial Blvd
StillwaterMN55082
mail: [EMAIL PROTECTED]
www: www.ejhassociates.com
tel: 651.207.1526
fax: 651.207.1536
mob: 651.245.2717


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Message: http://www.houseoffusion.com/lists.cfm/link=i:4:231549
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=11502.10531.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to