日期:2014-05-16  浏览次数:20734 次

多表拼接问题
现有多个格式相同的表 
例如 

select * from a 
--------------
id name 
1 111
2 222

select * from b
---------------
id name 
3 333
4 444

select * from c
---------------
id name 
5 555
6 666

现在需要查询的结果为

id name 
1 111
2 222
3 333
4 444
5 555
6 666

请问各位大大,语句应该怎么来写呢?

------解决方案--------------------
SQL code

    select d.* from 
    (select * from a  union 
     select * from b  union 
     select * from c 
    ) d

------解决方案--------------------
又是 union
如果要保留重复的 就是union all