I have a database of orders that looks roughly like this
ORDER ID | AMOUNT | FIRSTNAME | LASTNAME
1 50 JOHN SMITH
2 60 PAUL JOHNSON
3 20 FRANK CAMERON
5 80 JOHN JOHNSON
I have a list of names that I need to pull their orders. For this example lets say “JOHN SMITH” and “PAUL JOHNSON”
I have tried a query like this
SELECT * FROM ORDERS WHERE FIRSTNAME IN ("JOHN", "PAUL") AND LASTNAME IN ("SMITH", "JOHNSON")
But obviously that didn’t work how I wanted as it included. I’m not sure how to go about it but I need to search something like
WHERE FIRSTNAME,LASTNAME IN ("JOHN","SMITH";"PAUL","JOHNSON")
OR
WHERE (FIRSTNAME,LASTNAME) IN {("JOHN","SMITH")("PAUL","JOHNSON")}
Obviously I know little about SQL so I’m getting stuck on syntax and terminology of what to search for?
You can separate the logic with an
ORlike this: