oracle 分页方法

我分享两种:

1.用rownum

select * from (select p.* , rownum rn  from t_premium p where rn<= page * 10) a where a.rn > (page -1) * 10 + 1;

2.不用rownum

select * from (select p.*,row_number() over(order by p.premium_id) rn from t_premium p ) a where a.rn between (page -1) * 10 + 1 and page*10;

 

备注:补充一下row_number() over(order by id) 函数的相关介绍

 

https://blog.csdn.net/burpee/article/details/55517434

 

posted @ 2018-08-22 15:40  ziChuangShi  阅读(223)  评论(0编辑  收藏  举报