tags:

views:

39

answers:

1

Hello,

Is there a way to compare a list of numbers to a SQL subquery

something like WHERE 9,10,11 = (SELECT tableID FROM ....)

EDIT:

I guess my question isn't clear but I'm sorry, I really don't know how else to say this. I'm expecting a list of IDS back from the subquery like 1,2,3 or at least that's what I'd like the result to look like and then I want to compare the result to another list of numbers like 9,10,11 and see if they match.

+2  A: 

If the query is to match all numbers listed in the list with the sub-query, you may try this.

WHERE (SELECT COUNT(DISTINCT tableID) FROM xxx WHERE tableID IN (9,10,11)) = 3
Sujee