我要搭两张桌子。
表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发布于 2016-12-26 10:30:15
你只需要一个UNION ALL
select a, b, c, null d from table1
union all
select a, b, null, d from table2发布于 2016-12-26 10:29:03
试试看。这个问题有很多答案,但我认为这是最适合这种情况的:
select a, b, c, null as d
from table1
union all
select a, b, null as c, d
from table2;https://stackoverflow.com/questions/41329716
复制相似问题