Reputation: 20570
A normal IN
clause is written like this:
SELECT *
FROM x
WHERE
x.field IN (100, 200, 300, 400)
However, this is only one field. I need to write a query where I do look ups over 2 fields.
That is: Pseudo Code -->
SELECT *
FROM x
WHERE
IN (x.field1 = 100 AND x.field2 = 'someString', x.field1 = 200 AND x.field2 = 'someOtherString')
What is a convenient way to write such query?
Upvotes: 1
Views: 61
Reputation: 36107
Please take a look at this example: http://sqlfiddle.com/#!15/57223/1
select * from q
where
(x,y) in ((1,2),(5,5))
Upvotes: 2