Oracle分页2
常用这种,在内存分页上效率最高的,当然比不上物理分页咯
select * from (select row_.*, rownum rownum_ from (SELECT c.* FROM web_content c) row_ where rownum <=4+10 ) where rownum_ > 4
下面这种拿不出值,为什么呢
select b.*,rownum from web_content b where rownum in (SELECT RN FROM (SELECT ROWNUM RN,c.* FROM web_content c) a WHERE RN <= 5+4 )
------------------------------------------------------------------------------------------------------------------------------------------------------------------
select * from (select row_.*, rownum rownum_ from (
SELECT U.*
FROM
WEB_URL_CONFIG U
WHERE U.URL_ID !='0'
ORDER BY U.URL_STYLE,U.IS_VALID DESC
) row_ where rownum <=20 order by URL_STYLE,IS_VALID desc) where rownum_ > 10
有排序时,上面的SQL语句有问题,改成下面的任意两种
曾经理修改版:
select * from (select row_.*, rownum rownum_ from (
select aa.*,rownum
from (SELECT U.*
FROM
WEB_URL_CONFIG U
WHERE U.URL_ID !='0'
ORDER BY U.URL_STYLE,U.IS_VALID DESC
) aa
) row_ where rownum <=20 order by URL_STYLE,IS_VALID desc) where rownum_ > 10
黄经理版:
select t2.* from (select t1.*,rownum rnum from (
查询表全部数据
) t1 )t2 where <![CDATA[t2.rnum > #criteria.index#]]>
and <![CDATA[t2.rnum < (#criteria.rows#+#criteria.index#+1)]]>
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】凌霞软件回馈社区,博客园 & 1Panel & Halo 联合会员上线
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步