select rm, user_id, user_name, user_dept,user_position,user_salary 
from ( select  rownum rm,info.user_id, info.user_name,  salary.*  
         
            from info, salary where info.user_id=salary.user_id  
     
            order by info.user_id )       where rm between 1 and 5; 

解决方案 »

  1.   

    谢谢两位,可是我试了,还是一样的错误:首行user_id 说是未定义的列!到底是怎么回事呢?
      

  2.   

    select a.rm, a.user_id, a.user_name, a.user_dept,a.user_position,a.user_salary 
    from ( select  rownum rm,info.user_id, info.user_name,  salary.*  
             
                from info, salary where info.user_id=salary.user_id  
         
                order by info.user_id ) a      where rm between 1 and 5; 
      

  3.   

    我试了,可第一行到了第二个a,就是那个a.user_id就又不认识了。
        thank you all the same:)
      

  4.   

    我搞定了
    like this:select * from (select rownum as m,a.* from scc_user a)  where m between 3 and 8
      

  5.   

    楼上的说的对,可这仍是单表查询啊。我自己搞定了。谢谢各位:)  select * from 
             
            (select rownum rid,user_id,user_name,user_dept,user_position,user_salary  
           
              from
                 (select info.user_name,salary.*                 from zdy_userinfo info, zdy_salary salary 
         
                    where info.user_id=salary.user_id 
     
                     order by info.user_id )
               
              ) where rid between 1 and 5;
        在二层查询中不可用表名,无效,只需用列原名即可。
        二层查询中不该有info_id,否则外部的user_id成为未明确定义的列。