I have two tables
table1:
id state
-----------------
10 washington
11 oregon
12 california
table2:
product from to
--------------------------
piano 10 11
guitar 12 10
piano 12 11
and now I want to do a select-case that returns
-------------
piano washington oregon
piano california oregon
but I can't find out how. I have tried
SELECT id, state
FROM table1, table2
WHERE table2.product = 'piano' and table2.from = table1.state
but I cant figure out how to get the "to" state as well!
Best Regards
Eric
table1:
id state
-----------------
10 washington
11 oregon
12 california
table2:
product from to
--------------------------
piano 10 11
guitar 12 10
piano 12 11
and now I want to do a select-case that returns
-------------
piano washington oregon
piano california oregon
but I can't find out how. I have tried
SELECT id, state
FROM table1, table2
WHERE table2.product = 'piano' and table2.from = table1.state
but I cant figure out how to get the "to" state as well!
Best Regards
Eric
Comment