sql - Trouble making a running sum in Access query -
i'm stuck trying running sum work in access query. i've been playing around various dsum expressions, have resulted in errors. basically, have 2 columns, 1 year, 1 count of parts year, , third running sum of part count on years.
my sql first 2 columns looks this:
select datepart("yyyy",[eol]) ayear, count(equipmentquery.equipment) equipcount equipmentquery group datepart("yyyy",[eol]) order datepart("yyyy",[eol]);
any suggestions on how third column work running sum? help!
if create report, there property calculate running sum.
if prefer query, can use subquery calculate running sum:
select datepart("yyyy",[eol]) ayear , count(eq1.equipment) equipcount , ( select count(eq2.equipment) equipmentquery eq2 datepart("yyyy",eq2.[eol]) <= datepart("yyyy",eq1.[eol]) ) runningsuma equipmentquery eq1 group datepart("yyyy",[eol]) order datepart("yyyy",[eol]);
Comments
Post a Comment