SQL IN clause Using IN clause with a subquery

30% OFF - 9th Anniversary discount on Entity Framework Extensions until December 15 with code: ZZZANNIVERSARY9

Example

SELECT * 
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.



Got any SQL Question?