select name from table where recno<5020 and recno>5000
好象是吧,不太记得了

解决方案 »

  1.   

    select * from (select name,rownum rm from table) where rm>=5000 and rm<=5020
      

  2.   

    select name from table where rownum<5020 and rownum>5000
      

  3.   

    select name from table
    where deptno<5020 and deptno>5000;
      

  4.   

    首先select name from table where rownum<5020 and rownum>5000是不对的
    其次select * from (select name,rownum rm from table) where rm>=5000 and rm<=5020
    在算法上不好,还有什么好点的方法吗?
      

  5.   

    1. select ... where rownum<=m
       minus
       select ... where rownum<n
    2.use rowid
      

  6.   

    1  select * from  tbl1 where rownum<6 minus
    2* select * from tbl1 where rownum<2      ID A
    -------- ----------
           2 1a
           3 1a
           4 1a
           5 1a
      

  7.   

    Oracle中的数据是随机存储的,每次的选择可能结果都不一样!!!
      

  8.   

    我记得在sql-server中有个bengin...and,
    不知道行不行,我没试过
      

  9.   

    select * from (select rownum rn,table.* from table where rownum<5021)
    where rn>4999
    这样效率高一些,只扫描前5000条记录,如果是大表,可以节省很多时间.
      

  10.   

    修正如下:
    select * from (select rownum rn,table.* from table where rownum<5021)
    where rn>4999
    这样效率高一些,只扫描前5021条记录,如果是大表,可以节省很多时间.