Thanks!! Besides a SUM(Quantity) in place of MAX(Quantity), and for some reason the BETWEEN didn't work, so I had to use <>, it worked great. Thank you for your help!
Here is the final query that worked:
UPDATE Inventory
SET LastShipDate=OD.LastShipDa
FROM Inventory LEFT OUTER JOIN (
SELECT ItemNum, MAX(ShipDate) AS LastShipDate, SUM(Quantity) AS TotalShipQty
FROM OrderDetail
WHERE ItemNum >= 10000 and ItemNum < 11000 and ItemStatus='S'
GROUP BY ItemNum) OD ON Inventory.ItemNum = OD.ItemNum
Main Topics
Browse All Topics





by: gnoonPosted on 2009-02-14 at 20:04:47ID: 23643573
Try this
Select allOpen in new window