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
profile Fiilide 2nd February 2023

An extremely interesting share, besides cookie clicker is a great clicker game for you.

Write a comment ...
Post comment
Cancel

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