Running Total in Query

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi. I have a query which selects data from 1 table. The query produces the
following result...
ID Station Amount
1 Receiving 54
2 Receiving 100
3 Receiving 68
4 Receiving 19

Is there a way that I could perform a running total on the Amount field, so
that the Amount field is totalled with each record. The end result would
look like this...
ID Station Amount TotalAmount
1 Receiving 54 50
2 Receiving 100 154
3 Receiving 68 222
4 Receiving 19 241

Thanks.
 
Would you concider creating a report?
With a report it easy, you just add another field and in the field property
you specify running sum property to True.
 
Hi,



SELECT a.ID, LAST(a.Station), LAST(a.Amount), SUM(b.Amount)
FROM tableName As a INNER JOIN tableName As b
ON a.ID >= b.ID
GROUP BY a.ID




should do.



Hoping it may help,
Vanderghast, Access MVP
 
Thank you both for your suggestions!

Michel Walsh said:
Hi,



SELECT a.ID, LAST(a.Station), LAST(a.Amount), SUM(b.Amount)
FROM tableName As a INNER JOIN tableName As b
ON a.ID >= b.ID
GROUP BY a.ID




should do.



Hoping it may help,
Vanderghast, Access MVP
 
Back
Top