--UPDATE TRS.INV_INFO SET INV_QTY=b1.QTY
SELECT a.ITEM_NO,a.INV_QTY,b1.QTY
FROM TRS.INV_INFO a,(
SELECT b.DETAIL_ITEM,SUM(a.HEAD_MARK*b.DETAIL_NET) QTY
FROM TRS.INV_HEAD a,TRS.INV_DETAIL b
WHERE a.HEAD_NO=b.HEAD_NO
--AND b.DETAIL_ITEM='A02'
AND a.HEAD_STATUS='P'
GROUP BY DETAIL_ITEM
) b1 where a.ITEM_NO=b1.DETAIL_ITEM
AND a.INV_QTY!=b1.QTY
ORDER BY A.ITEM_NO
查詢及更新邊角廢料明細與總計 SQL
最新推荐文章于 2024-08-16 18:17:46 发布