This query finds the name of every client that has ever bought tuna. This is a nice way to filter one table (clients) based on data in another table (sales). You can do the same thing with an
but I find this version easier to read.
WHERE id in (
SELECT DISTINCT client_id
WHERE item = 'tuna'
Let's go through that query one step at a time:
isn't necessary but if there were tons of duplicates the
might make the query run faster.
|1||mr darcy||[email protected]|