How Can I Add A Running Total Of One Column To An Access Query?
I have a query that contains in one field the percentage of total sales corresponding to a specific product in the past 12 months. For example: Product 1 - 38% Product 2 - 25% Prod
Solution 1:
If you have an ID field, or a date field, you can use a variation of this correlated subquery.
SELECT t.*,
t.productpct+[prev_value] AS RunningSum,
(select sum([ProductPct])
from test AS t2
WHERE
t2.ID < t.ID
) AS Prev_Value
FROM test AS t;
There are people who are way better at SQL than I, however if this helps or gives you your answer then great.
Post a Comment for "How Can I Add A Running Total Of One Column To An Access Query?"