SELECT *
FROM
(SELECT A.*, ROWNUM RN
FROM
(SELECT *
FROM tb_news
where isload=0
order by isload desc) A
WHERE ROWNUM < 15)
WHERE RN >=10;
有Order by 的查询,采用这种写法效率会比较高。
无Order by 的查询,可以讲rownum写在一起效率比较高
SELECT A.*, ROWNUM RN
FROM
(SELECT *
FROM tb_news
where isload=0
order by isload desc
) A
WHERE ROWNUM < 15 AND ROWNUM>10;