create table tb(a int,b int) insert into tb(a) select 4 union select 8 union select 6 union select 9select * from tbselect a.a,b=sum(b.a) from tb a,tb b group by a.a drop table tb
B字段如果是Int类型 update 表 set b=(select sum(Cast(a as int)) from 表)
select a,(select sum(Cast(a as int)) from 表) b from 表
select *, b=(select sum(cast(a as int)) from a ) from a
from 表
insert into tb(a)
select 4
union select 8
union select 6
union select 9select * from tbselect a.a,b=sum(b.a) from tb a,tb b group by a.a
drop table tb
update 表 set b=(select sum(Cast(a as int)) from 表)
from 表