declare @t table ( id int, SomeNumt int ) insert into @t select 1,10 union select 2,12 union select 3,3 union select 4,15 union select 5,23
Try this
select t.id, t.SomeNumt, sum(t.SomeNumt) Over (Order by t.id asc Rows Between Unbounded Preceding and Current Row) as cum from @t t group by t.id, t.SomeNumt order by t.id asc;