I have the query:
SELECT * FROM `users`
WHERE (`firstname` LIKE 'Luke' AND `lastname` LIKE 'Skywalker') OR
(`firstname` LIKE 'Foo' AND `lastname` LIKE 'Bar') OR
(`firstname` LIKE 'Tom' AND `lastname` LIKE 'Turner');
But i would like to make it a bit more readable by using a where … in …
I tried
SELECT * FROM users
WHERE `firstname`
IN ('Luke','Foo','Tom') AND `lastname` IN ('Skywalker','Bar','Turner');
But unfortunately this will also match "Tom Skywalker", "Foo Turner" and all mixes you can think off.
I have to select on first and lastname (perhaps more fields like DOB) since i am getting data from an external API and i have to check if those names are in our system.
1 Answer