tags:

views:

52

answers:

2

I am aware of the query syntax:

SELECT fields FROM table WHERE value in (1,2,3,4)

But I have two values (x and y), can I use the "in" syntax for them or will I have to go with what I used to use before in and have a large set of WHERE conditions:

SELECT fields FROM table WHERE (x = 1 AND y = 2) OR (x = 3 AND y = 4)
+1  A: 

You could do something like this, if y is always going to be less than 1000:

SELECT fields FROM table
WHERE x*1000+y in (1002,3004)

It's a bit hackish, but could do what you're after?

Chris
+4  A: 

I believe this is what you are looking for...

WHERE (1,2) IN ((1,2), (3,4))
gahooa
Should this be WHERE (x,y) IN ((1,2),(3,4)) ?
Peter Boughton