认真看看25楼咯
inner Join (Sel ect a.GHSDM, SUM(fQuantity) As 销售数 From {shangpin_A} As a inner Join {SG_Gatherings} As b On a.SPDM = b.vstyle And {SDPHDMX}.GG1DM = B.VCOLOR And {SDPHDMX}.GG2DM = B.VSIZE Group By a.GHSDM) As d On c.GHSDM = d.GHSDM Order By c.批次号 DESC
改为
.inner Join (Sel ect a.DJBH, SUM(fQuantity) As 销售数 From {SDPHDMX} As a inner Join {SG_Gatherings} As b On a.SPDM = b.vstyle And a.GG1DM = B.VCOLOR And a.GG2DM = B.VSIZE Group By a.DJBH) As d On c.DJBH= d.DJBH Order By c.批次号 DESC