Oracle 分页查询的一个实例

1.分页模板

select * from ( select rownum as rn , a.* from( 某个表名) a) where rn between 0 and 6

2 某个表名

select aa.title,aa.url,bb.times, bb.makedate from menu aa,
(select count(*) times,title , max(id) id,max(makedate) makedate from menulog group by title order by count(*) desc ) bb where aa.id=bb.id

3 将2 放入到1 中

select * from ( select rownum as rn , a.* from( select aa.title,aa.url,bb.times, bb.makedate from menu aa,
(select count(*) times,title , max(id) id,max(makedate) makedate from menulog group by title order by count(*) desc ) bb where aa.id=bb.id) a) where rn between 0 and 6

猜你喜欢

转载自www.cnblogs.com/zytcomeon/p/13208042.html