好贷网好贷款

谁能帮我把这张拼凑表改一改,能帮我压缩一下 100分,无满意结帖,结帖人qiyuxiaozi]

发布时间:2016-12-3 10:23:08 编辑:www.fx114.net 分享查询网我要评论
本篇文章主要介绍了"谁能帮我把这张拼凑表改一改,能帮我压缩一下 100分,无满意结帖,结帖人qiyuxiaozi]",主要涉及到谁能帮我把这张拼凑表改一改,能帮我压缩一下 100分,无满意结帖,结帖人qiyuxiaozi]方面的内容,对于谁能帮我把这张拼凑表改一改,能帮我压缩一下 100分,无满意结帖,结帖人qiyuxiaozi]感兴趣的同学可以参考一下。

select sum((nvl(cpjs.总计, 0) + nvl(dz.dfybje, 0) +                    nvl(fh.noriginalcursummny2, 0) +                    nvl(psjz.psjzjs, 0) * -1)) as 本月,                ks.kszj as byzj           from (select pk_cumandoc as kszj                   from bd_cumandoc                  where bd_cumandoc.pk_cubasdoc = '0001A1100000000084IK') ks           full outer join (select (nvl(gs.gsjz, 0) + nvl(kz.kzjz, 0) +                                  nvl(wb.wbjz, 0)) * -1 as 总计,                                  gs.gsjz * -1 as 公司,                                  kz.kzjz * -1 as 扣赠,                                  wb.wbjz * -1 as 网点,                                  gs.gsks as 客商档案                             from (select sum(nvl(so_saleorder_b.noriginalcursummny,                                                  0)) as gsjz,                                          bd_cumandoc.pk_cumandoc as gsks                                     from so_sale                                    inner join so_saleorder_b on so_sale.csaleid =                                                                 so_saleorder_b.csaleid                                    inner join bd_busitype on so_sale.cbiztype =                                                              bd_busitype.pk_busitype                                    inner join bd_cumandoc on so_sale.ccustomerid =                                                              bd_cumandoc.pk_cumandoc                                    where (so_sale.dr = 0)                                      and (so_saleorder_b.dr = 0)                                      and so_sale.vdef1 = '结转单'                                      and (so_sale.dbilldate >= '2009-05-01')                                      and (so_sale.dbilldate <= '2009-10-10')                                      and (bd_cumandoc.pk_cubasdoc =                                          '0001A1100000000084IK')                                      and (bd_busitype.busicode = 'A03')                                    group by bd_cumandoc.pk_cumandoc) gs                             full outer join (select case sum(nvl(so_saleorder_b.noriginalcursummny,                                                             0))                                                      when 0 then                                                       0                                                      else                                                       sum(nvl(so_saleorder_b.noriginalcursummny,                                                               0))                                                    end as kzjz,                                                    bd_cumandoc.pk_cumandoc as gzks                                               from so_sale                                              inner join so_saleorder_b on so_sale.csaleid =                                                                           so_saleorder_b.csaleid                                              inner join bd_busitype on so_sale.cbiztype =                                                                        bd_busitype.pk_busitype                                              inner join bd_cumandoc on so_sale.ccustomerid =                                                                        bd_cumandoc.pk_cumandoc                                              where (so_sale.dr = 0)                                                and (so_saleorder_b.dr = 0)                                                and bd_busitype.busicode =                                                    ('A03')                                                and so_sale.vdef1 = '结转单'                                                and so_saleorder_b.blargessflag =                                                    ('Y')                                                and (so_saleorder_b.dr = 0)                                                and (so_sale.dbilldate >=                                                    '2009-05-01')                                                and (so_sale.dbilldate <=                                                    '2009-10-10')                                                and (bd_cumandoc.pk_cubasdoc =                                                    '0001A1100000000084IK')                                              group by bd_cumandoc.pk_cumandoc) kz on kz.gzks =                                                                                      gs.gsks                             full outer join (select sum(nvl(so_saleorder_b.noriginalcursummny,                                                            0)) as wbjz,                                                    bd_cumandoc.pk_cumandoc as wbks                                               from so_sale                                              inner join so_saleorder_b on so_sale.csaleid =                                                                           so_saleorder_b.csaleid                                              inner join bd_busitype on so_sale.cbiztype =                                                                        bd_busitype.pk_busitype                                              inner join bd_cumandoc on so_sale.ccustomerid =                                                                        bd_cumandoc.pk_cumandoc                                              where (so_sale.dr = 0)                                                and (so_saleorder_b.dr = 0)                                                and (bd_busitype.busicode =                                                    'A04')                                                and (so_sale.dbilldate >=                                                    '2009-05-01')                                                and so_sale.dbilldate <=                                                    '2009-10-10'                                                and (bd_cumandoc.pk_cubasdoc =                                                    '0001A1100000000084IK')                                              group by bd_cumandoc.pk_cumandoc) wb on wb.wbks =                                                                                      gs.gsks) cpjs on ks.kszj =                                                                                                       cpjs.客商档案          后边还有后续 因为太长无法发出,那个高手能帮忙改改 急,QQ是8596824 

这个强 怎么压缩啊  直接做成视图来调用好了

先分成几个视图吧,再连接成一个视图

生成视图操作比较好点 楼主所指的压缩是啥?

帮顶

这么长,分成几个视图或表再连接吧

好强,这么长的连接

这只有3/1不到  因为我取数太多 有些是可以合并的 但是 我没有找到好的方法  这个是用来做报表的  有大拿帮帮不

改善表结构。 否则没什么好办法。

业务逻辑 方面入手下 

nvl好像是Orcale的函数

这个问题正在学习中 过来向高手学习学习 帮顶 楼主解决问题后 请记得把解决的方法详细说一下 让我们也好好学习

这个需要知道表结构 和你的业务逻辑 否则无法弄

  帮顶  --Learn Up

先分 在整

该回复于2010-01-19 17:28:40被版主删除

太强

太强

太长了没有看完,还是顶!

太长了,晕,只能顶了!

有点晕,帮顶

  每天回帖即可获得10分可用分

上一篇:CSDN的垃圾问题。自认是高手的来!! 10Z782282738]
下一篇:一条insert 语句 5gaishishengzhu1314]

相关文章

相关评论