select * from ( select r.*,rownum n from ( select a.*,c.credit dsp_credit ,b.accountname from fcustomers  a left join customers@game c on a.loginname=c.loginname,fcustomer_info b where a.loginname=b.loginname and to_date('2011-04-01 00:00:00','yyyy-mm-dd HH24:mi:ss')<=a.jointime and to_date('2011-04-01 23:59:59','yyyy-mm-dd HH24:mi:ss')>=a.jointime  order by a.loginname desc ) r where  rownum<=30) where n>0上面连了三个表,有一个游戏库的dblink,看有什么优化的,提点意见,谢谢
一起进步一下,
给分不是问题

解决方案 »

  1.   

    select *
      from (select r.*, rownum n
              from (select a.*, c.credit dsp_credit, b.accountname
                      from fcustomers a
                      left join customers@game c on a.loginname = c.loginname,
                     fcustomer_info b
                     where a.loginname = b.loginname
                       and to_date('2011-04-01 00:00:00', 'yyyy-mm-dd HH24:mi:ss') <=
                           a.jointime
                       and to_date('2011-04-01 23:59:59', 'yyyy-mm-dd HH24:mi:ss') >=
                           a.jointime
                     order by a.loginname desc) r
             where rownum <= 30)
     where n > 0基本上很明确的SQL了。左连接去掉,用EXISTIS试试。。