Find records from one table that not exists in other table.

Find records from one table that not exists in other table.

If we have product table and order table and we need to get those products which have not ordered by any customer as shown in above image.

 

SELECT p.id FROM product as p LEFT JOIN orders as o ON p.id = o.product_id WHERE o.product_id IS NULL

 

 

0   0
Sangita Singh

List Your Business

Improve Your Business Visibility

Please rotate your device

We don't support landscape mode on your device. Please rotate to portrait mode for the best view of our site