Good article.. Thanks!..
Here is how I would have solve the problem.
UPDATE a
SET a.netInventoryQty=c.inventoryQty-b.cQty
--SELECT *
FROM demand a
INNER JOIN (
select a.demandID, sum(b.orderQty) as cQty
FROM demand a
INNER JOIN demand b ON b.demandID<=a.demandID AND b.itemID=a.itemID
GROUP BY a.demandID
) b on b.demandID=a.demandID
INNER JOIN Inventory c ON c.itemID=a.itemID
I'll have to check out if your method is faster.
Thanks again