Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

a way to calculate a running total in SQL

Status
Not open for further replies.

RBE

Programmer
May 25, 2000
72
US
Is it possible to calculate a running total in SQL, and if so how? Using access 2K.
 
what do you mean running total? John Fill
1c.bmp


ivfmd@mail.md
 
Kind of like this

order# order total Running Total
1234 2.00 2.00
1255 2.00 4.00
1268 2.00 6.00
1355 2.00 8.00

and so on.

I am trying to create this in a query so I can preform calculations off the field in other expression fields.
 
if the table has some order column you can:

select [order], [order total],
(select sum(t.[order total])
from yourTable t where t.order < yourTable.order
) [Running Total]
from yourTable John Fill
1c.bmp


ivfmd@mail.md
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top