select identity(int,1,1) as No,* into #T from yourtable
select *,(select sum(本月用量) as 总计 from
#t where No<=tem.No and convert(char(4),年月,120)='2002' as 本年本本月止累计用量 from #t as tem
select *,(select sum(本月用量) as 总计 from
#t where No<=tem.No and convert(char(4),年月,120)='2002' as 本年本本月止累计用量 from #t as tem
(select sum(本月用量) from table_name where year(年月)=year(t1.年月) and
month(年月)<=month(t1.month)) as '本年本月止累计用量'
from table_name as t1
(select cast(sum(cast(left(rtrim(ltrim(本月用量)),len(rtrim(ltrim(本月用量)))-1) as float))as varchar(10))+'吨' from table_name where year(年月)=year(t1.年月) and month(年月)<=month(t1.年月)) as '本年本月止累计用量'
from table_name as t1