oracle 分頁方法

我分享兩種:函數

1.用rownum.net

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

2.不用rownumrem

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;select

 

備註:補充一下row_number() over(order by id) 函數的相關介紹分享

 

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

相關文章
相關標籤/搜索