Help solve my SQL mystery
February 19, 2009 11:32 AM
Subscribe
How can I get the IN function to work in my SQL?
There are two tables, CONTACT and QUEUE. CONTACT's columns are contactid and queuelist. QUEUE's columns are queueid and queuename.
Example CONTACT record
contactid = user1, queuelist = 'q1','q2'
Example QUEUE records
queueid = q1, queuename = Queue1
queueid = q2, queuename = Queue2
queueid = q3, queuename = Queue3
SQL
SELECT queuename
FROM QUEUE
WHERE queueid IN
(SELECT queuelist
FROM CONTACT
WHERE contactid = 'user1')
except this SQL doesn't produce Queue1 and Queue2 as the expected output and I can't figure out why. If I simply replace the select statement in the brackets with 'q1','q2' (the queuelist) it works.
Is there something fundamental I'm missing?
posted by urbanwhaleshark to computers & internet (12 comments total)
posted by hattifattener at 11:36 AM on February 19