5
回答
oracle SQL优化,吐槽点拨都欢迎,也许就有灵感了
【腾讯云】学生服务器套餐10元/月 >>>   
select k.productid,
                       k.productname,
                       k.dcInventory,
                       sum(k.storeauditqty),
                       k.dcName,
                       k.productstatus_Id,
                       avg(k.weekDaySaleQuantity),
                       avg(k.monthDaySaleQuantity),
                       sum(k.inventoryVolume),
                       sum(k.recommendQuantity),
                       sum(k.storeQuantity),
                       sum(k.regionQuantity),
                       sum(k.lineTotalPrice)
                  from (select dc.InventoryVolume as dcInventory,
                               t.*,
                               b.userid           as ba_userid
                          from T_BIZ_STORESALESTOCK_Replenish dc,
                               t_biz_replenishorderdetail     t,
                               t_biz_userdatagroup            b
                         where b.leveloneid = t.leveloneid
                           and b.leveltwoid = '0'
                           and t.status in ('2', '1', '0')
                           and b.userid = '62637'
                           and t.regionid = 'QSZHS'
                           and dc.orgid = t.dcid
                           and dc.productid = t.productid
                           and dc.orgid like 'D%'
                        union all
                        select dc.InventoryVolume as dcInventory,
                               t.*,
                               b.userid           as ba_userid
                          from T_BIZ_STORESALESTOCK_Replenish dc,
                               t_biz_replenishorderdetail     t,
                               t_biz_userdatagroup            b
                         where b.leveltwoid = t.leveltwoid
                           and b.leveltwoid > '0'
                           and t.status in ('2', '1', '0')
                           and b.userid = '62637'
                           and t.regionid = 'QSZHS'
                           and dc.orgid = t.dcid
                           and dc.productid = t.productid
                           and dc.orgid like 'D%') k
                 group by k.productid,
                          k.productname,
                          k.productstatus_Id,
                          k.dcInventory,

                          k.dcName

大家都支招,看看怎么优化下,现在运行太慢了。@宏哥 可是高手,怎么能不at呢?嘿嘿

举报
sxgkwei
发帖于6年前 5回/194阅
顶部