能够预览但是不能选取-模板数据集
本帖最后由 mfkpie82080 于 2013-8-3 22:21 编辑
select month(co_return.trans_date) mon ,sum(act_recv_line.goods_amt) 金额, '月退货' 退货 from act_recv_line,co_return where act_recv_line.shipper_no=co_return.trans_no
and act_recv_line.trans_type='co_return' group by mon,退货
union all
select month(shipper.trans_date) mon ,sum(act_recv_line.goods_amt) shipper_amt,'月发货' 发货 from act_recv_line,shipper where act_recv_line.shipper_no=shipper.trans_no
and act_recv_line.trans_type='shipper' group by mon,发货
union all
select month(act_receivable.trans_date) mon,sum(-act_recv_line.disc_amt) disc_amt, 'GG——折扣' GG折扣 from act_recv_line,act_receivable where act_recv_line.disc_amt is not null and act_recv_line.trans_no=act_receivable.trans_no group by mon,GG折扣
union all
select month(h.trans_date) mon,sum(d.ar_amt) ar_amt,i.description
from act_recv_line d Join act_receivable h On d.trans_no=h.trans_no
Join item i on d.item_id=i.item_id
where d.trans_type='QT' and d.ar_amt is not null
group by mon,i.description
13292