select term_code,company_id from(select a.term_code,a.company_id,rownum rn from ecc_imr_term a,distributer b where a.distributer_id=b.distributer_id and b.node_id = '20' and a.sts = 'A' and ((term_code between 2500 and 2649) or (term_code between 3000 and 3999))) where rn>180 and rownum<61rn rownum要怎么看啊这个sql语句?
ORACLE分页sql要怎么理解会比较清楚点啊

解决方案 »

  1.   

    参考一下5楼第16个程序:http://topic.csdn.net/u/20081002/00/f8d90ba2-e2bb-412a-a0c5-1b6d518fc22a.html
      

  2.   

    这种分页写法才是正确的select *
      from (
    select term_code,company_id, rownum rn
      from (
       select a.term_code,a.company_id
         from ecc_imr_term a,distributer b 
        where a.distributer_id=b.distributer_id and b.node_id = '20' and a.sts = 'A' 
          and ((term_code between 2500 and 2649) or (term_code between 3000 and 3999))
          ) 
     where rownum < 180 + 61
         )
     where rownum > 180