求一SQL语句实现两个表合并
两个表个结果一样,但是字段名字不一样.
tb_a:的字段有a1,a2,a3
tb_b:的字段有b1,b2,b3
实现把tb_b合并到tb_a中,b1对应a1,b2对应a2,b3对应a3.
如:
tb_a表
a1 a2 a3
1 2 3
11 22 33
-------黄金分割线----------
tb_b表
b1 b2 b3
b b b
bb bb bb
执行我求的SQL语句后tb_a表的内容
tb_a表
a1 a2 a3
1 2 3
11 22 33
b b b
bb bb bb
谢谢大家了
------解决方案--------------------select a1,a2,a3 from a union
select b1 as a1,b2 as a2,b3 as a3 from b
------解决方案--------------------select * from a1
union
select * from b1
------解决方案--------------------INSERT INTO tb_a(a1,a2,a3) SELECT b1,b2,b3 FROM tb_b