I’m doing this query to get rows that are in table_b and not in table_a:
SELECT table_b.* FROM table_b
LEFT JOIN table_a ON table_b.id = table_a.id
WHERE table_a.item_id IS NULL
This works ok but I need another condition to apply on table_a. I need to compare only the rows that got column X equal with the ID of 3, not to compare the whole table. Any ideas ?
Thanks.
I’m not sure if you’re looking for table_a column x or table_b column x, but the idea is to add that to the join ON clause: