Running Total

D

Don

How do can you write a query to show a running total. If I had a table with
employee, date, amount how would I get a additional column to show the
running total
Row 1 - Smith, 1/1/05, $500, $500
Row 2 - Smith, 1/8/05, $750, $1,250
Row 3 - Smith, 1/9/05, $100, $1,350

Thanks

Don
 
M

Marshall Barton

Don said:
How do can you write a query to show a running total. If I had a table with
employee, date, amount how would I get a additional column to show the
running total
Row 1 - Smith, 1/1/05, $500, $500
Row 2 - Smith, 1/8/05, $750, $1,250
Row 3 - Smith, 1/9/05, $100, $1,350


Use a calulated field that consists of a subquery.

RunAmt: (SELECT Sum(Amt) FROM table As X WHERE X.date <=
table.date AND X.employee = table.employee)
 
Top