日期:2014-05-17 浏览次数:20431 次
select a.JOBNO,e.P_CODE,e.QTY,e.CODE,b.DEFA_QTY,sum(c.QTY) as 'c.QTY' ,sum(d.QTY) as 'd.QTY',sum(e.QTY) as 'e.QTY'
from A表 a
join B表 b on a.JOBNO = b.JOBNO and a.CODE =b.CODE
join C表 c on a.JOBNO = c.JOBNO and a.CODE =c.CODE
join D表 d on a.JOBNO = d.JOBNO and a.CODE =d.CODE
join E表 e on a.JOBNO = e.JOBNO and a.CODE =e.CODE
group by a.JOBNO,e.P_CODE,e.QTY,e.CODE,b.DEFA_QTY