我在第一个表中有三列,第二个表有一列存在于第一个表中,2列我想要添加.
例如:
select c1 as col1, c2 as col2, c3 as col3
from Table1
union
select c1, c4 as col4, c5 as col5
from Table2
expected Result:
col1,col2,col3,col4,col5
Run Code Online (Sandbox Code Playgroud)
jue*_*n d 12
只需添加null或任何其他默认值作为静态列
select c1 as col1,
c2 as col2,
c3 as col3,
null as col4,
null as col5
from Table1
union
select c1,
null,
null,
c4,
c5
from Table2
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
22542 次 |
| 最近记录: |