| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 4225 人关注过本帖
标题:pb union all 后如何把不是0的数字弄在同一行显示
取消只看楼主 加入收藏
jlswcy
Rank: 1
等 级:新手上路
帖 子:2
专家分:0
注 册:2015-3-9
收藏
 问题点数:0 回复次数:1 
pb union all 后如何把不是0的数字弄在同一行显示
这个是代码:
SELECT salrcd.dptid as dptid,
         (select dptdes from dpt where dptid =salrcd.dptid) as dptdes,   
         sum(((- 1 )+sign(salrcd.qty))/2 * salrcd.sttamt) as thje,   
         count(distinct salrcd.scd) as kds,   
         sum(salrcd.sttamt) as ssje,   
         sum(round(salrcd.qty * salrcd.rtlprc,2)) as ysje,
        0 as patamt,   
        0 as cstamt,
        0 as rvnamt,
        0 as mlamt,
        0 as mll
         
    FROM salrcd  
   WHERE ( salrcd.trddtm >= (:as_bdt+'000000') ) AND  
         ( salrcd.trddtm <= (:as_edt+'235900') ) AND  
         ( salrcd.dptid like :as_fd )   
GROUP BY salrcd.dptid

UNION ALL

select
        bizdep.savdptid as dptid,
       (select dptdes from dpt where bizdep.savdptid = dpt.dptid) as dptdes,
        0 as thje,   
        0 as kds,
        0 as ssje,
        0 as ysje,
       round(sum(patamt),2) as patamt,
       round(sum(cstamt*(1+taxrto)),2) as cstamt,
       round(sum(rvnamt),2) as rvnamt,
       round((round(sum(patamt),2) - round(sum(cstamt*(1+taxrto)),2)),2) as mlamt,
       round((round(sum(patamt),2) - round(sum(cstamt*(1+taxrto)),2)) / round(sum(patamt),2),4) as mll
  from scst,bizdep
 where scst.depid = bizdep.depid and
       scst.dptid = bizdep.dptid and
       bizdep.savdptid not like '6%' and            
       bizdep.savdptid like :as_fd and
       scst.actdat >= :as_bdt and
       scst.actdat <= :as_edt   
group by bizdep.savdptid

执行以后显示的结果如下:请大家 帮忙 怎么才能让他显示的结果 在一行呢。谢谢了

001   542.17   6559  521.65   583.55    0    0    0    0    0
001    0    0    0    0      910    442.04  75.43    468.22  0.37

我想要的结果是这样
001   542.17   6559  521.65   583.55  910    442.04  75.43    468.22  0.37
搜索更多相关主题的帖子: count where 如何 
2015-03-09 10:25
jlswcy
Rank: 1
等 级:新手上路
帖 子:2
专家分:0
注 册:2015-3-9
收藏
得分:0 
求那个大神 看一下  有没有 大神知道的啊!!
2015-03-09 13:43
快速回复:pb union all 后如何把不是0的数字弄在同一行显示
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.016252 second(s), 10 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved