Oracle 分页

总结了一下几种方法 具体在MSSQL SYBASE下面用top 来分页 POSTGRESQL MYSQL就直接用limit更简单了

在oracle 下面想了5总方法

一: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

五:with

with partdata as (select rownum rowno,t.* from table1 t where t.id>200407160000)
select * from partdata where rowno between 10 and 20

你可能感兴趣的:(Oracle 分页)