select *
  from (select ti.id_card_, ti.name_
          from t_teller_info_ ti, adm_agency_ a
         where ti.org_code_ = a.id_
           and a.level_code_ like '%/6696/%')
 where rownum < = 10
此sql有什么问题么?

解决方案 »

  1.   

    select * from (select ti.id_card_, ti.name_ from t_teller_info_ ti, adm_agency_ a where ti.org_code_ = a.id_ and a.level_code_ like '%/6696/%')tt where rownum < = 10 
      

  2.   

    直接把rownum放在里层查询就行了,
    select ti.id_card_, ti.name_
              from t_teller_info_ ti, adm_agency_ a
             where ti.org_code_ = a.id_
               and a.level_code_ like '%/6696/%' where rownum < = 10;
      

  3.   

    多了个where
    select ti.id_card_, ti.name_
              from t_teller_info_ ti, adm_agency_ a
             where ti.org_code_ = a.id_
               and a.level_code_ like '%/6696/%' and rownum < = 10;
      

  4.   

    其实我想说的是,这条简单的语句做分页查询时查不出结果集,但是加上order by后就能够进行分页查询
      

  5.   

    做分页应该还有个rownum大于select *
      from (select ti.id_card_, ti.name_,rownum
              from t_teller_info_ ti, adm_agency_ a
             where ti.org_code_ = a.id_
               and a.level_code_ like '%/6696/%') t
     where rownum < = 10看这样行不行。
      

  6.   

    select *
      from (select ti.id_card_, ti.name_, rownum rn
              from t_teller_info_ ti, adm_agency_ a
             where ti.org_code_ = a.id_
               and a.level_code_ like '%/6696/%' order by 唯一主键)
     where rn > 10
       and rn < = 20
      

  7.   


    只有一个rownum <= 10如何实现分页?