I have a table like this:
ManufacturerID ProductID Price Region
==============================================
100 1 12.00 A
100 2 20.00 A
100 3 25.00 A
100 4 30.00 B
101 1 15.00 A
101 2 20.00 A
101 4 30.00 B
I want to get a query result that compares 2 different manufacturers to look like this:
ProductID Price1 Price2 Region
=========================================================================
1 12.00 15.00 A
2 20.00 20.00 A
3 25.00 null A
4 30.00 30.00 B
I try to use left join on the same table:
SELECT ProductID, a.Price AS Price1, b.Price AS Price2, a.Region
FROM table1 a
LEFT JOIN table1 b ON a.ProductID = b.ProductID AND a.ManufacturerID = 100
WHERE b.ManufacturerID = 101
but this doesn't give me the missing product (ID:4) from Manufacturer 101. What am I missing?