I saw the running total example with the cursor and so on. Here is ONE simple single SQL statement(with a inline SELECT) which calculates the running total in Access OR MSSQL. No cursors required, only 6 lines of code, VERY fast and VERY simple. HERE GOES...
SELECT pro.ProductID, pro.ProductName, pro.UnitPrice,
(SELECT SUM(pro1.UnitPrice)
FROM Products pro1
WHERE pro1.ProductID <= pro.ProductID) AS RuningTotal
FROM Products pro
ORDER BY pro.ProductID
Comments