oracle分页查询sql

查询第11~20条数据:

1、无order by排序的写法:

select * from 
   (select rownum as rowno,t.* from  test t where rownum <= 20)tt
 where tt.rowno > 10;

2、有order by排序的写法:

select * from 
   (select tt.*, rownum as rowno from
        (select t.* from  test t order by t.time desc) tt
    where rownum <= 20)
 where rowno > 10

猜你喜欢

转载自well-lf.iteye.com/blog/1881597