利用minus实现分页时进行排序的解决方案

来源:百度文库 编辑:神马文学网 时间:2024/04/29 02:23:53
SQL> select * from a;
CW
----------
3
4
1
SQL> select * from b;
LH
----------
1
5
SQL> select * from a order by cw
2 minus
3 select * from b order by lh
4 /
minus
*
ERROR 位于第 2 行:
ORA-00933: SQL 命令未正确结束
SQL> select * from (select * from a order by cw)
2 minus
3 select *from (select * from b order by lh)
4 /
CW
----------
3
4
try again:
select category_id from category where rownum<20
minus
select category_id from category where rownum<10
order by 1