update T1 set 累计缴=(select sum(a.实缴-a.应缴) from T1 a where a.编号=t1.编号
and cast(cast(a.年份 as char(4))+right(100+a.月份,2)+'01' as datetime)<=cast(t1.年份 as char(4))+right(100+t1.月份,2)+'01')
where 编号='01' and 年份=year('2001/05/01') and 月份=month('2001/05/01')
and cast(cast(a.年份 as char(4))+right(100+a.月份,2)+'01' as datetime)<=cast(t1.年份 as char(4))+right(100+t1.月份,2)+'01')
where 编号='01' and 年份=year('2001/05/01') and 月份=month('2001/05/01')
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货