ORACLE 分頁SQL語句

2021-09-05 15:09:07 字數 526 閱讀 9048

總結了一下幾種方法 具體在mssql sybase下面用top 來分頁 postgresql mysql就直接用limit更簡單了

在oracle 下面想了4總方法

minus差分頁 select * from table where rownum<=10 minus select * from table where rownum<=5

rownum偽列select * from (select rownum tid,t.* from table t where rownum<=10) where tid<=10 and tid>=5

notin相反select * from table where id not in(select id from table where rownum<=5) and rownum<=5

前題是id排序的select * from table where id>(select max(id) from table where rownum<=5) and rownum<=5

要是有更好的方法 還望多多指教

ORACLE分頁SQL語句

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...

Oracle分頁sql語句

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

ORACLE分頁SQL語句

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...