现有多个格式相同的表
例如 select * from a
--------------
id name
1 111
2 222select * from b
---------------
id name
3 333
4 444select * from c
---------------
id name
5 555
6 666现在需要查询的结果为id name
1 111
2 222
3 333
4 444
5 555
6 666请问各位大大,语句应该怎么来写呢?
例如 select * from a
--------------
id name
1 111
2 222select * from b
---------------
id name
3 333
4 444select * from c
---------------
id name
5 555
6 666现在需要查询的结果为id name
1 111
2 222
3 333
4 444
5 555
6 666请问各位大大,语句应该怎么来写呢?
select d.* from
(select * from a union
select * from b union
select * from c
) d
如果要保留重复的 就是union all