oracle分页

分页三步:

1:排序
2:编号
3:取范围

select empno,ename,sal from emp order by empno


select rownum rw,e.* from () e


select * from () where rw between 1 and 3

 

select * from (
select rownum rw,e.* from (
select empno,ename,sal from emp order by empno
) e)

where rw between 1 and 3

 

page pagesize
  1           3

(page-1)*pagesize+1 start
page*pagesize end

 

分页的算法: page页数 pagesize一页的条数
(page-1)*pagesize+1 start
page*pagesize end

posted @ 2015-12-30 09:24  汪强胜  Views(121)  Comments(0Edit  收藏  举报