I have two different tables with a similar column in both. And i need to query for all rows in table A but must exempt specific rows in table A if those rows exist in table B.
Example:
Table A
---------------------------------
item_id | item_name | price
---------------------------------
1 | apple | 100
---------------------------------
2 | banana | 150
---------------------------------
3 | ginger | 120
---------------------------------
4 | pear | 150
---------------------------------
5 | berry | 120
---------------------------------
Table B
---------------------------------
item_id | item_owner |
---------------------------------
1 | Ben |
---------------------------------
2 | Damian |
---------------------------------
3 | Greg |
---------------------------------
Based on the example above, I need to run a query to fetch all the rows in table A if item_id does not exist in table B.
The result of this query should fetch only 2 rows which are:
---------------------------------
4 | pear | 150
---------------------------------
5 | berry | 120
---------------------------------
Would ber glad to get help with this…Thank!
Demo.