SELECT a.ProductId, a.UnitPrice, a.Quantity, SUM(a.UnitPrice * a.Quantity) AS RunningTotal FROM [Order Details] a CROSS JOIN [Order Details] b WHERE (b.ProductId <= a.ProductId) GROUP BY a.ProductId, a.UnitPrice, a.Quantity ORDER BY a.ProductId, a.UnitPrice, a.QuantityWhich gives me:
ProductId UnitPrice Quantity RunningTotal ----------- --------------------- -------- --------------------- 1 14.40 10 5472.00 1 14.40 12 6566.40 1 14.40 15 24624.00 1 14.40 18 9849.60 2 15.20 7 8724.80 2 15.20 10 12464.00 2 15.20 20 49856.00 2 15.20 24 29913.60 2 15.20 25 62320.00 2 19.00 5 15580.00 2 19.00 8 12464.00 3 8.00 20 15040.00 3 8.00 30 22560.00 3 10.00 25 23500.00 3 10.00 30 28200.00 3 10.00 49 46060.00 3 10.00 60 56400.00 4 17.60 10 20064.00 4 17.60 16 32102.40 4 17.60 18 36115.20 4 22.00 21 52668.00 4 22.00 25 188100.00 4 22.00 30 75240.00 4 22.00 50 376200.00Thanks for pointing me in the right direction!