日期:2014-05-17 浏览次数:20576 次
create table test1
--测试数据
(name varchar(10),
[201201] int,
[201202] int,
[201203] int,)
create table test2
(name varchar(10),
[201201] int,
[201202] int,
[201203] int,)
select * from dbo.test1
select * from dbo.test2
/*
name 201201 201202 201203
---------- ----------- ----------- -----------
Income 1 2 3
(1 row(s) affected)
name 201201 201202 201203
---------- ----------- ----------- -----------
income_tt 1 3 6
(1 row(s) affected)
*/
update text1 set 201202=(select SUM(201201+Mtd201202)