I have 2 tables:
And I want to create UNION query, based on the common rows of EAN. Like, in the end, I want my table to look like:
Any helps would be really appreciated!
Thanks in advance!
Advertisement
Answer
Try this ?
SELECT a.ean, a.price, a.company, a.lowestPrice FROM Table1 a UNION SELECT b.ean, b.price, b.company, NULL AS lowestPrice FROM Table2 b INNER JOIN Table1 c ON c.ean = b.ean