Declare @t table (id int identity, value int) Insert into @t(value) Select 120 union all Select 60 union all Select 125 union all Select 40 union all Select 10 union all Select 25 union all Select 40 union all Select 55 union all Select 70 union all Select 85 union all Select 100 union all Select 115 union all Select 130 union all Select 145 union all Select 160 union all Select 175 union all Select 190 union all Select 205 ;With a as ( Select 1 as id, t1.value as value, t1.value as total From @t t1 Where id=1 Union All Select t2.id as id, t2.value as value, a.total+t2.value as total From a Inner Join @t t2 on a.id+1=t2.id Where t2.id is not null ) Select id, Value, total from a Order by id