create table testDB
(
id int identity(1,1) primary key,
name varchar(20) not null,
sales dec(18,2)
)

insert into testDB values('张三',10)
insert into testDB values('李四',20)
insert into testDB values('王五',30)
insert into testDB values('赵立权',40)
insert into testDB values('张华',50)
insert into testDB values('周杰',60)

select * from testDB
select id,name,sales,(select sum(sales) from testDB where id<=a.id) as 'total' from testDB a

sql 梯形统计

相关文章:

  • 2021-12-09
  • 2021-10-06
  • 2022-12-23
  • 2022-12-23
  • 2022-01-13
  • 2021-07-09
  • 2022-03-09
  • 2022-12-23
猜你喜欢
  • 2021-12-09
  • 2021-04-28
  • 2021-11-30
  • 2021-11-25
  • 2022-12-23
相关资源
相似解决方案