mda said:
I want to create a column in a query where cumulative values are
created from an other column.
For example:
Column1 Column2
1 1
1 2
4 6
etc.
Thank you for helping me. (if possible)
If there is a third column which is a unique key, then you can do this
with a subquery. Suppose you have example table "tblExample" with these
columns:
PK Amount
1 1
2 1
3 4
4 5
5 23
Then you can write a query like this:
SELECT
tblExample.PK,
tblExample.Amount,
(
SELECT Sum(T.Amount) FROM tblExample T
WHERE T.PK <= tblExample.PK
) AS RunningTotal
FROM tblExample
ORDER BY tblExample.PK;
That may not be exactly correct, as I haven't tested it.