How to compare int list to SQL subquery
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 lis开发者_Python百科t 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.
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
精彩评论