Hi, I have two tables tbl1 and tbl2, both with two columns, one for id and one for product. I want to extract the rows that are in both, i.e. rows where tbl1.id = tbl2.id and tbl1.product = tbl2.product and join the row from tbl1 and tbl2 into one row.
I imagine this goes something like this:
SELECT tbl1.\*, tbl2.\*
FROM tbl1, tbl2
WHERE tbl1.id = tbl2.id
AND tbl1.product = tbl2.product
or
SELECT tbl1.\*, tbl2.\*
FROM tbl1
INNER JOIN tbl2
ON tbl1.id = tbl2.id
AND tbl1.product = tbl2.product
?
I've an added problem, whereby products do not have the same names in the two spreadsheets.
I added a mappings table which holds the product name in tbl1 and it's corresponding tbl2 product name in each row.
How would I know achieve the equivalent of the above SQL query with this added table (where only one row is output for each id/product combination that exists in both)?
Thanks for any help.
(Note: I'm using MS Access)