Oracle 分頁查詢

2021-07-24 16:28:50 字數 544 閱讀 7846

/*

* firstindex:起始索引

* pagesize:每頁顯示的數量

* sql:可以是簡單的單錶查詢語句,也可以是複雜的多表聯合查詢語句

*/select * from(select a.*,rownum rn from(sql) a where rownum<=(firstindex+pagesize)) where rn>firstindex

* firstindex:起始索引

* pagesize:每頁顯示的數量

* ordercolumn:排序的欄位名

* sql:可以是簡單的單錶查詢語句,也可以是複雜的多表聯合查詢語句

*/select * from(select * from(select t.*,row_number() over(order

by ordercolumn) as rownumber from(sql) t) p where p.rownumber>firstindex) where rownum<=pagesize

ORACLE分頁查詢

單錶分頁 start num 起始行號 end num 截止行號 select t.from select s.rownum rn from table s where rownum end num t where rn start num 多表分頁 select from select temp....

Oracle分頁查詢

oracle的分頁查詢語句基本上可以按照本文給出的格式來進行套用。分頁查詢格式 select from select a.rownum rn from select from table name a where rownum 40 where rn 21 其中最內層的查詢select from t...

oracle 分頁查詢

1 要把rowid來分 select from t xiaoxi where rowid in select rid from select rownum rn,rid from select rowid rid,cid from t xiaoxi order by cid desc where r...