t-sql - find differences for pk's in a single table (Self join?)
- by Pace
Hi Experts,
My situation is this. I have a table of products with a pk "Parent" which has "Components" The data looks something like this
Parent(PK) Component
Car1 Wheel
Car1 Tyre
Car1 Roof
Car2 Alloy
Car2 Tyre
Car2 Roof
Car3 Alloy
Car3 Tyre
Car3 Roof
Car3 Leather Seats
Now what I want to do is some query that I can feed two codes in and see the differences... IE If I feed in "Car1", "Car2" it would return something like;
Parent Component
Car1 Wheel
Car2 Alloy
As this is the difference between the two. If I said "Car1", "Car3" I would expect;
Parent Component
Car1 Wheel
Car3 Alloy
Car3 Leather Seats
Your help with this matter would be greatly appreciated.