Compounded SUM in SQL Server -


this question has answer here:

is possible compounded sum in sql server? e.g.

month salary total

jan 1000 1000

feb 1200 2200

mar 1000 3200

. . .

. . .

please help.

declare @t table( months varchar(10), salary int)  insert @t select 'jan', 1000 union select 'feb', 1200 union select 'mar', 1000 ;with cte ( select *,row_number()over(order (select null))rn @t ) ,cte1 ( select a.*,salary [total] cte rn=1 union select a.*,a.salary+total cte inner join cte1 b on a.rn-b.rn=1 ) select * cte1 

Comments

Popular posts from this blog

Android layout hidden on keyboard show -

google app engine - 403 Forbidden POST - Flask WTForms -

c - Why would PK11_GenerateRandom() return an error -8023? -