当前位置: 代码迷 >> Oracle开发 >> 多表联合取别号出错
  详细解决方案

多表联合取别号出错

热度:55   发布时间:2016-04-24 06:42:36.0
多表联合取别名出错
原语句(A union all B)union all (select ·· from  (A union all B))成功
我想改写成
(A union all B)as temp union all (select ·· from  temp) 但在as处报错 为什么啊,求解决方法
------解决方案--------------------
肯定报错啊。。。union all是对两个结果集进行合并。。。
两个结果集是平等关系,不能互相引用表。
------解决方案--------------------
引用:
我不去别名引用成功了啊


不取别名那叫引用吗?那不就是复制粘贴原语句吗?引用不是用一个别名代替原语句吗?
with temp as (A union all B)
select * from temp union all (select ·· from  temp) 
  相关解决方案