Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- SELECT
- iArrQTY - arr.iQuantity,
- po_m.cPOID,
- po_d.ID,
- po_d.cInvCode,
- po_d.iQuantity,
- po_d.iNum,
- po_d.iSum,
- po_d.iNatSum,
- po_d.iInvQTY,
- po_d.iInvNum,
- po_d.iArrQTY,
- po_d.iArrNum,
- po_d.iArrMoney,
- po_d.iNatArrMoney,
- po_d.fPoValidQuantity,
- po_d.fPoValidNum,
- po_d.fPoArrQuantity,
- po_d.fPoArrNum,
- rd01.iQuantity rd_quantity,
- rd01.iNum rd_inum,
- arr.iQuantity arr_quantity,
- arr.iNum arr_inum
- -- update po_d
- --
- -- set iArrQTY = arr.iQuantity,
- -- iArrNum = arr.iNum,
- -- iArrMoney = arr.iOriSum,
- -- iNatArrMoney = arr.iSum,
- -- fPoValidQuantity = arr.iQuantity,
- -- fPoValidNum = arr.iNum,
- -- fPoArrQuantity = arr.iQuantity,
- -- fPoArrNum = arr.iNum
- FROM [dbo].[PO_Podetails] po_d
- LEFT JOIN PO_Pomain po_m
- ON po_d.POID = po_m.POID
- LEFT JOIN (
- select
- rd01_d.iPOsID,
- sum(rd01_d.iQuantity) iQuantity,
- sum(rd01_d.iNum) iNum
- FROM RdRecords01 rd01_d
- GROUP BY rd01_d.iPOsID
- ) rd01
- on rd01.iPOsID = po_d.ID
- LEFT JOIN (
- SELECT
- arr_d.iPOsID,
- sum(arr_d.iOriSum) iOriSum,
- sum(arr_d.iSum) iSum,
- sum(arr_d.iQuantity) iQuantity,
- sum(arr_d.iNum) iNum
- FROM PU_ArrivalVouchs arr_d
- GROUP BY arr_d.iPOsID
- ) arr
- on arr.iPOsID = po_d.ID
- where po_d.iArrQTY != arr.iQuantity
- -- and iArrMoney != iNatArrMoney
- -- and po_d.iArrQty = iInvQTY + 5
- -- or arr.iQuantity > po_d.iQuantity
- -- and cInvCode like '%CWLT600728%'
- -- and cInvCode not like 'YF%'
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement