原语句(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)