I got a database structure with three tables. On table containing some ids and two table containing the same row and a foreign key on the first table :
Table A: id 1 2 3 Table B: a_id row_abc 1 value1 2 value3 3 value6 Table C: a_id row_abc 1 value2 2 value7 4 value9
How to get a result looking like this (a kind of left join were each result is displayed in lines instead of in additional columns in the result):
id row_abc 1 value1 1 value2 2 value3 2 value7 3 value6 4 value9
Advertisement
Answer
I think you want union all
:
select a_id as id, row_abc from b union all select a_id, row_abc from c;