标准的rownum分页查询使用方法
select *
from (select c* rownum rn from content c)
where rn >=
and rn <=
但是如果 加上order by addtime 排序则数据显示不正确
select *
from (select c* rownum rn from content c order by addtime)
where rn >=
and rn <=
解决方法再加一层查询则可以解决
select *
from (select rownum rn t*
from (select title addtime from content order by addtime desc) t)
where rn >=
and rn <=
如果要考虑到效率的问题上面的还可以优化成(主要两者区别)
select *
from (select rownum rn t*
from (select title addtime from content order by addtime desc) t
where rownum <= )
where rn >=