WHERE ... IN with multiple columns
I am trying to get some users who meet certain conditions:
SELECT * FROM users
WHERE lastname IN ('Pitt','Jolie','Costner')
AND firstname IN ('Brad','Angelina','Kevin')
But in this way, Kevin Jolie and Brad Costner will be shown that is NOT what I want.
So, I tried:
SELECT * FROM users
WHERE (lastname,firstname) IN ('Pitt','Brad'),('Jolie','Angelina'),('Costner','Kevin')
What is causing the error:
An expression of non-boolean type specified in a context where a condition is expected, near ','.
Do you know a query that will give the expected result?
Attn: Two or more columns are not always varchar columns, they can be of any type.
+3
source to share