#2
jlswcy2015-03-09 13:43
|
这个是代码:
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