• oracle多表查询分页


    5 楼bjshasha(傻傻)回复于 2003-04-28 17:54:05 得分 0

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

    6 楼dawnzdy(dawn)回复于 2003-04-29 09:37:40 得分 0

    楼上的说的对,可这仍是单表查询啊。我自己搞定了。谢谢各位:)      
       
      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成为未明确定义的列。

    我程序中测试的。取前30条,主要oracle没有类似sql server的top
    select * from  
    (
      Select a.*, ROWNUM RN  From
      (SELECT c.customer_code,c.customer_character,c.customer_officer,c.customer_balance,c.customer_creditline,l.*
       from loan_fact_loans l left join loan_fact_customer c on l.customer_id = c.customer_id
       Order By loans_balance Desc,loans_date Desc ) a
    )Where RN <= 30

  • 相关阅读:
    使用Xtrabackup 备份mysql数据库
    Myeclipse总结
    intellij idea问题及技巧
    Tomcat相关配置
    Spark常用算子总结
    前端开发经验
    最近用到的SQL语句
    subline text使用心得
    天龙八部谁是主角?(MR词频统计)
    elasticsearch CURL命令
  • 原文地址:https://www.cnblogs.com/huang/p/1579585.html
Copyright © 2020-2023  润新知