解决方案: |
SELECT PurSettleVouchs.iRdsID,SUM(PurSettleVouchs.iSVQuantity) AS iSVQuantity,
SUM(PurSettleVouchs.iSVAPrice) AS iSVAPrice
into lichen
FROM PurSettleVouch
INNER JOIN PurSettleVouchs ON PurSettleVouch.PSVID=PurSettleVouchs.PSVID
WHERE PurSettleVouch.dSVDate>='2005-01-01'
AND cBusType='普通采购'
GROUP BY PurSettleVouchs.iRdsID
update rdrecords
set isquantity=isvquantity,imoney=isvaprice
from rdrecords
join lichen on AutoID=iRdsID
where iSQuantity<>iSVQuantity
or iMoney<>iSVAPrice
DROP TABLE lichen
|