SELECT * FROM TABLE_NAME WHERE b IN(5,7) AND c IN(4,4)
This query will return rows where b is either 5 or 7 , AND c - 4 .
What do you mean by "evaluation in pairs?"
Update:
I will add another line to the sample:
+----------+----------+----------+ | PK | b | c | +----------+----------+----------+ | 1 | 2 | 3 | +----------+----------+----------+ | 2 | 5 | 4 | +----------+----------+----------+ | 3 | 7 | 9 | +----------+----------+----------+ | 4 | 7 | 4 | +----------+----------+----------+ | 5 | 2 | 9 | +----------+----------+----------+
If you want to match all sets, you can use this syntax:
SELECT * FROM table_name WHERE (b, c) IN ((2, 3), (7, 9))
This means: "return all rows where b is 2 and c is 3 , OR b is 7 and is 9 at the same time."
In the above example, this query will return rows 1 and 3
But if you rewrite this request in another way, for example:
SELECT * FROM table_name WHERE b IN (2, 7) AND c IN (3, 9)
this will mean "return all rows where b is either 2 or 7 , AND c is either 3 or 9 ).
This will return lines 1 , 3 and 5 , since line 5 satisfies the condition of the second query, but not for the first.
Quassnoi
source share