Reputation: 108
I have two tables (products and span_products) with many columns each but each has one called part_no, The should have the same part numbers in both tables but in a different order,
whats the easiest way to show which rows aren't in the span_products table
Upvotes: 0
Views: 34
Reputation: 44766
Or use a NOT EXISTS:
select *
from products p
where NOT EXISTS (select 1 from span_products s where s.part_no = p.part_no)
I.e. select all products that aren't found in span_products.
Upvotes: 0
Reputation: 204766
Use a left join
select p.*
from products p
left join span_products s on s.part_no = p.part_no
where s.part_no is null
Upvotes: 1