2016-12-26 7 views
0

2つの表を結合する必要があります。混在した列を持つ2つの表を結合する

表1

Columns A, B, C 
Row 1 10, 20, 30 
Row 2 40, 50, 60 

表2

Columns A, B, D 
Row 1 70, 80, 90 
Row 2 5, 6, 7 

Output should be 
Columns A, B, C, D 
Row 1 10, 20, 30, null 
Row 2 40, 50, 60, null 
Row 3 70, 80, null, 90 
Row 4 5, 6, null, 7 
+0

質問は非常に不明瞭である必要があります。詳細情報を追加してください。 – GurV

+0

私はあなたがこれを必要とすると思います。 'table1.a、table1.b.table1.c、table2.dをtable1.a = table2.aとtable1.b = table2のtable1 inner join table2から選択してください。 b' –

答えて

0

あなただけUNION ALL

select a, b, c, null d from table1 
union all 
select a, b, null, d from table2 
+1

ありがとうGurwinder – NItin

0

に参加し、それを試してみてください。この質問は答えをたくさん持っているが、私は、これはこの場合に最も適していると思う:

select a, b, c, null as d 
    from table1 
    union all 
    select a, b, null as c, d 
    from table2; 
関連する問題