Running Totals in an SQL Query
March 2, 2011 Skip Marchesani
There are situations when running an SQL query for data analysis where I like to generate a running total based on a column in the table that is the target of the query, to assist with the data analysis. “What’s a running total?” you ask. Wikipedia and I define it as the summation of a sequence of numbers that is updated each time a new number is added to the sequence, simply by adding the value of the new number to the running total. To explain how to generate a running total, I use an example based on a department |