----创建测试数据
declare @ta table(id int,colX int)
declare @tb table(id int,colX int)
insert @ta
select 1,1 union all
select 2,1 union all
select 3,1 union all
select 4,1 
insert @tb
select 1,1 union all
select 1,1 union all
select 1,1 union all
select 2,1 union all
select 2,1 union all
select 3,1 ----更新
update a set colX = b.colX from @ta as a
inner join (select id,isnull(sum(colX),0) as colX from @tb group by id) b
on a.id = b.id
----查看
select * from @ta/*结果
id   colX
1    3
2    2
3    1
4    1
*/