时间:2021-07-01 10:21:17 帮助过:3人阅读
取出中间5条记录:
SELECT NO FROM ( SELECT ROW_NUMBER() OVER (ORDER BY NO) RNO, NO FROM ROWNUM_TEST ) WHERE RNO BETWEEN 5 AND 10 ORDER BY NO;
方法2:利用子查询
取出前5条记录:
SELECT NO FROM ( SELECT NO FROM ROWNUM_TEST ORDER BY NO )WHERE ROWNUM <= 5 ORDER BY NO ;
取出中间5条记录:
SELECT NO FROM ( SELECT NO, ROWNUM RNO FROM ( SELECT NO FROM ROWNUM_TEST ORDER BY NO ) ) WHERE RNO BETWEEN 5 AND 10 ORDER BY NO;
Oracle取TOP N条记录
标签: