Oracel中, 要查询某一表中的第11到15条之间的记录,写得sql语句如下:select * from ( select * from table_name where rownum <= 15 order by rowid desc ) 
where rownum <= 5这样,虽然能够得到结果,但是是倒序显示(显示的数据是从第15条到第11条,但我想要得结果是应该顺序显示,该如何写语句??select * from ( select * from ARREGISTERPOLICY where rownum <= 15 order by rowid desc ) 
where rownum <= 5 order by rowid desc, 报错初学者,请高人指点。

解决方案 »

  1.   

    select *
    from(
    select a.*,row_number() over (order by rowid desc) rn
    from table_name a)
    where rn>=11 and rn<=15 
      

  2.   


    select * from((select rownum as myrownum,a.* from(select * from ARREGISTERPOLICY) a where rownum<=15) )where myrownum>11
      

  3.   

    楼上的不错,有个小小笔误 > 11 ----》 >=11
      

  4.   

    select * from 
    (
      select * from ARREGISTERPOLICY where rownum  <= 15 order by rowid desc 
    ) t
    where rownum  <= 5 order by rowid desc select * from 
    (
      select * from ARREGISTERPOLICY where rownum  <= 15 order by rowid  
    ) t
    where rownum  <= 5 order by rowid desc 
      

  5.   

    ???
    2楼的没问题啊,要不你试试这个select * from((select rownum as myrownum,a.* from table_name a where rownum <=15) )where myrownum>11
      

  6.   

    ???
    2楼的没问题啊,要不你试试这个select * from((select rownum as myrownum,a.* from table_name a where rownum <=15) )where myrownum >= 11
    ;