34,590
社区成员
发帖
与我相关
我的任务
分享
create table #t
(proName varchar(50), date int, [money] float, yumoney float, syumoney float, allmoney float)
insert #t
select 'mmmmmmm', 8, 1000, 1500, 500, 2000
union all select 'mmmmmmm', 9, 1000, 500, 1500, 0
select proName, date, (select sum([money]) from #t where date <= t.date and proName = t.proName) [money],
yumoney, syumoney, (select sum([allmoney]) from #t where date <= t.date and proName = t.proName) allMoney
from #t t
where date = 9
那还不简单
select 字段A,字段B,字段C from 表名 where m and n