SQL Query : Excluding records which doesn't exists in other table
Problem : Select only the customers with no associated purchase order
Output CUSTOMER_ID column
SQL
SELECT c.customer_id
FROM customer c WHERE c.customer_id NOT IN (
SELECT DISTINCT po.customer_id
FROM purchase_order po
)
No comments:
Post a Comment
Note: only a member of this blog may post a comment.