oracle 分页成功但是数据不正确

来源:互联网 发布:zodgame账号淘宝 编辑:程序博客网 时间:2024/05/17 01:38

oracle 分页语句如下

--分页查询一
select * from (select a1.*,rownum rn from (select * from student) a1 where rownum <=5) where rn>=2;
--分页查询二
select a1.* from (select student.*,rownum rn from student where rownum <=5) a1 where rn >=3;
--分页查询三
select a1.* from (select student.*,rownum rn from student) a1 where rn between 3 and 5;

上述情况是正常的

但是如果在from 里的select 语句中使用order by 语句会导致分页数据不正确,修改方法将order by 放到最外层的 语句之后,分页之后在排序

原创粉丝点击