I have a table called Tmpstockledger that I am trying to update stockledger with. Ths issue is TMPStockledger has multiple records based on the join and its only updating with values from first record in TMPSTOCKLEDGER. How do I get it to update with both values. I'm updated a bunch of values I'll just post one for an example:
UPDATE StockLedgerbackup
SET
CurrentInventoryUnits =T.CurrentInventoryUnits + S.CurrentInventoryUnits
FROM StockLedger S
inner JoinTmpStockLedger T
on
S.ClassCode = T.ClassCode and
S.Vendornum = t.VendorNum and
S.StoreCode = T.StoreCode and
S.WeekendingDate = T.WeekendingDAte
WHERE
S.ClassCode = T.ClassCode and
S.Vendornum = t.VendorNum and
S.StoreCode = T.StoreCode and
S.WeekendingDate = T.WeekendingDAte
and T.weekendingdate = '2005-02-26'
and T.Storecode = 521
UPDATE StockLedgerbackup
SET
CurrentInventoryUnits =T.CurrentInventoryUnits + S.CurrentInventoryUnits
FROM StockLedger S
inner JoinTmpStockLedger T
on
S.ClassCode = T.ClassCode and
S.Vendornum = t.VendorNum and
S.StoreCode = T.StoreCode and
S.WeekendingDate = T.WeekendingDAte
WHERE
S.ClassCode = T.ClassCode and
S.Vendornum = t.VendorNum and
S.StoreCode = T.StoreCode and
S.WeekendingDate = T.WeekendingDAte
and T.weekendingdate = '2005-02-26'
and T.Storecode = 521