In english   |   suomeksi

Homepage
IT Services
Consulting
Training
Get help now
Application Development
Support and Downloads
Contact Us
Send us a comment or question
Applications
MS Access
MS Excel
Coding and Macros
Excel VBA

Creating Cumulative (Running) Sum - SQL

One of the most simple ways to have the query make an additional running sum to a field. This requires the table to have distinct values only on a keyfield (in this case Mth)

SELECT Totals2.Product, Totals2.Mth, Totals2.Qty, (SELECT SUM(Qty) 
FROM Tbl_Totals Totals1 where Totals1.Mth <= Totals2.Mth) AS RunningSum
FROM Tbl_Totals AS Totals2
ORDER BY Totals2.Mth;

Result:

runningsum.png

Last modified on August 19 2015

Back to Support and Downloads

News
 
Retrieve Your favorite (NYSE) Stocks with our Excel tool
Microsoft Excel, Access VBA Developing Services
IT Training
WEB Design and applications
MSDN
MSDN ExcelBlog
MSDN AccessBlog
Articles
Time parameters for Google search
 

Search from our site:



Registered Microsoft Partner

Phone: +358 50 566 6858
Helsinki, Finland
mika.oukka@netti.fi