oracle的 sql 使用union all 连接两个结果集,分别加入order by出错的解决方式
--执行下方的union all sql Oracle会报错的
select * from tab_a order by id
union all
select * from tab_b order by age;
再外面再套一层查询。
缺点是数据过多,执行速度可能变慢
--像这样写,执行就不会报错,也达到了自己的目的
select * from (select * from tab_a order by id)
union all
select * from (select * from tab_b order by age);