select a.pluno,a.pluname,a.spec,a.curcsprc ,a.slprc ,
d.qty 西部销售,e.qty 东部销售,f.qty 中区销售,g.qty 团购销售,
a1.qty 西部库存,a2.qty 东部库存,a3.qty 中区库存,a4.qty 团购库存
from 商品码 a
left join (select pluno,sum(qty) qty from xbxs where rq between ‘20140701‘ and ‘20140801‘ group by pluno ) d on a.pluno=d.pluno
left join (select pluno,sum(qty) qty from dbxs where rq between ‘20140701‘ and ‘20140801‘ group by pluno ) e on a.pluno=e.pluno
left join (select pluno,sum(qty) qty from zqxs where rq between ‘20140701‘ and ‘20140801‘ group by pluno ) f on a.pluno=f.pluno
left join (select pluno,sum(qty) qty from tgxs where rq between ‘20140701‘ and ‘20140801‘ group by pluno ) g on a.pluno=g.pluno
left join (select pluno,qty from sskc where mddm=‘6015‘) a1 on a.pluno=a1.pluno
left join (select pluno,qty from sskc where mddm=‘7606‘) a2 on a.pluno=a2.pluno
left join (select pluno,qty from sskc where mddm=‘0004‘) a3 on a.pluno=a3.pluno
left join (select pluno,qty from sskc where mddm=‘0008‘) a4 on a.pluno=a4.pluno
where a.dptno like ‘1005%‘
【数据处理】各门店销售库存数据分析