当前位置: 代码迷 >> Oracle技术 >> 多表拼接有关问题
  详细解决方案

多表拼接有关问题

热度:82   发布时间:2016-04-24 08:33:28.0
多表拼接问题
现有多个格式相同的表 
例如 

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
  相关解决方案