Using IN clause with a subquery
suggest changeSELECT *
FROM customers
WHERE id IN (
SELECT DISTINCT customer_id
FROM orders
);
The above will give you all the customers that have orders in the system.
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents