常用这种,在内存分页上效率最高的,当然比不上物理分页咯
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)]]>