1、分页查询1--上限条件必须放在子查询,而下限条件必须放在外层查询
SELECT * FROM ( SELECT A.*,ROWNUM RN FROM (SELECT * FROM AM_ACCT_NET) A WHERE ROWNUM<=50 ) WHERE RN>=2;
2、分页查询2
SELECT * FROM ( SELECT A.*,ROWNUM RN FROM (SELECT * FROM AM_ACCT_NET) A ) WHERE RN BETWEEN 2 AND 50;
3、实例
SELECT * FROM (SELECT ROWNUM AS ROWNO,T.* FROM AM_ACCT_NET T WHERE T.POST_DATE BETWEEN ('20170307') AND ('20180809') AND ROWNUM<=40) WHERE ROWNO>=1;
结果