表结构如上图,想要实现如下功能:
1,将上一年度的Remanent更新到下一年度的LastYearRemanent;
2,当年度的TotalRating等于LastYearRemanent加上CurrentRating;
3,当年度的Remanent等于TotalRating减去CurrentLyLeave;
如何实现?
1/
update TableName
set Remanent=LastYearRemanent
go
2/
select * from TableName
where TotalRating=(LastYearRemanent+CurrentRating)
go
3/
select * from TableName
where Remanent=(TotalRating-CurrentLyLeave)
go
注意:进行运算时要确定数据类型正确