Hey, I thought I had this down but I'm having a bit of a problem

Consider a table like so.
id, listofids
"33","33,44,55,66"
"rr","rr,gg,cc,dd"
"xx","zz,ee,rr"

I'm trying to get a list of all the records where the value of the
first is somewhere in the second.

I'm thinking
SELECT 
id,
listofids,
FROM 
table
WHERE 
CHARINDEX(id ,listofids) <> 0

Or perhaps 

SELECT 
id,
listofids
FROM 
gv_locations
WHERE 
',' + listofids + ',' LIKE '%' + id + '%'

But neither returns any records.

Any ideas?

Thanks. Andre


-- 
DRE
www.webmachineinc.com
www.theanticool.com

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Logware (www.logware.us): a new and convenient web-based time tracking 
application. Start tracking and documenting hours spent on a project or with a 
client with Logware today. Try it for free with a 15 day trial account.
http://www.houseoffusion.com/banners/view.cfm?bannerid=67

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