Using IN clause with a subquery

suggest change
SELECT * 
FROM customers 
WHERE id IN (
    SELECT DISTINCT customer_id 
    FROM orders
);

The above returns every customer that has an order. A NULL customer_id in orders does not match any customer.

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents