能否讲解一下 rownum?最好来个例子
rownum问题--如何查询表中第90条到100条的记录

解决方案 »

  1.   

    select * from 
    (select rownum jl,a.* from tzb a) 
    where jl between 90 and 100或者
    select * from tab
    where rownum < 100 and not exists
    (select 1 from tab where rownum<90)
      

  2.   

    举个例子select r,e.* from (select rownum r,last_name,salary from (
    select last_name,salary from employees order by nvl(salary,0) desc)) e
    where r between 90 and 100;
      

  3.   

    select * from tab where rownum < 101 
    minus 
    select * from tab where rownum<89;
      

  4.   

    select  rw ,e.* from (select rownum rw ,lname,fname from abc where rownum<30) where rw>=0这样的写法速度才是最快的.
    select * from tab where rownum < 101 
    minus 
    select * from tab where rownum<89;
    minus运算效率太慢了...
      

  5.   

    select  rw ,e.* from (select rownum rw ,lname,fname from abc where rownum<30) where rw>=0
    -------------------------不知道e . 是从那里来的  是abc 这个表吗?
      

  6.   

    select  rw ,e.* from (select rownum rw ,lname,fname from abc where rownum<=100 order by lname) where rw>=90如果表abc有lname的索引,这条SQL就可以取以lname排序的第90到第100行记录。