日期:2014-05-17  浏览次数:20968 次

如何用sql语句查询某一数据表某十条连续的记录,比如前十条,第十一到第二十条等等?
RT

------解决方案--------------------
1-10条
SELECT * FROM TABLE__NAME WHERE ROWNUM <10;
10-20条
SELECT * FROM TABLE__NAME WHERE ROWNUM <20
MINUS
SELECT * FROM TABLE__NAME WHERE ROWNUM <10;
------解决方案--------------------
我想要分:

1-10:
SELECT 字段1,字段2,... FROM (SELECT b.字段1,b.字段2,...,rownum r FROM 表名 b) where r between 11 and 20
10-20:
SELECT 字段1,字段2,... FROM (SELECT b.字段1,b.字段2,...,rownum r FROM 表名 b) where r between 11 and 20
......