首页 > 代码库 > 当前年以前工资的总和

当前年以前工资的总和

技术分享

 

create table b
(
Years int,
Salaty int
)
insert into b values(2000,1000)
insert into b values(2001,2000)
insert into b values(2002,3000)
insert into b values(2003,4000)

select * from b
go
select Years, (select sum(Salaty) from b where b.Years<= c.Years) Salaty from b c

当前年以前工资的总和