两表只有一个字段不相同,进行表连接形成新表。
表1结构:
A1 A2 A3 A4
22 33 44 55
表2结构:
A1 A2 A3 B4
66 77 88 99
期望值:连接出来的新表
A1 A2 A3 A4 B4
22 33 44 55 NULL
66 77 88 NULL 99
希望能够出期望值的结果表,谢谢。
------解决方案--------------------select A1, A2, A3, A4,'' as B4 from t1
union all
select A1, A2, A3, '',B4 from t2
------解决方案--------------------
select A1, A2, A3, A4,null as B4 from t1
union all
select A1, A2, A3, null as A4,B4 from t2