Select a. pluno, A. pluname, A. spec, A. curcsprc, A. slprc,
D. qty Western sales, E. qty Eastern sales, F. qty central sales, G. qty group buying sales,
A1.qty West inventory, a2.qty East inventory, a3.qty central inventory, a4.qty group buying inventory
From commodity code
Left join (select pluno, sum (qty) qty from xbxs where RQ between '000000' and '000000' group by pluno) D on A. pluno = D. pluno
Left join (select pluno, sum (qty) qty from dbxs where RQ between '000000' and '000000' group by pluno) e on A. pluno = E. pluno
Left join (select pluno, sum (qty) qty from zqxs where RQ between '000000' and '000000' group by pluno) F on A. pluno = f. pluno
Left join (select pluno, sum (qty) qty from tgxs where RQ between '000000' and '000000' group by pluno) g on A. pluno = G. pluno
Left join (select pluno, qty from sskc where mddm = '000000') A1 on a. pluno = a1.pluno
Left join (select pluno, qty from sskc where mddm = '000000') A2 on A. pluno = a2.pluno
Left join (select pluno, qty from sskc where mddm = '000000') A3 on A. pluno = a3.pluno
Left join (select pluno, qty from sskc where mddm = '000000') A4 on A. pluno = a4.pluno
Where a. dptno like '20140901'