oracle分页,带有排序字段

select detail_num,carriage_num,ed_date,created_date from
(select rownum id,detail_num,carriage_num,ed_date,created_date from
(select detail_num,carriage_num,ed_date,created_date from xx order by created_date desc) where rownum<=(?)*200
) where id>=(?-1)*200

先对数据库中的所有记录排序,然后再对这些有序的记录分页。如果不这样的话,分页后的数据,每页都是有序的,但是整体无效

 

posted @ 2017-12-06 17:34  jjkang  阅读(418)  评论(0编辑  收藏  举报