update a set a.total=a.total+ (select isnull(sum(b.total),0) from b where a.kind=b.kind group by kind)
-- 试一下这个,未测试。 update a set a.total=a.total+ (select sum(b.total) from b where a.kind=b.kind and b.total is not null) where exists(select * from b where a.kind = b.kind and b.total is not null )
update a set total=total+ (select isnull(sum(cishu),0) from b where kind=a.kind group by kind)
(select isnull(sum(b.total),0)
from b where a.kind=b.kind
group by kind)
-- 试一下这个,未测试。
update a
set a.total=a.total+ (select sum(b.total) from b where a.kind=b.kind and b.total is not null)
where exists(select * from b where a.kind = b.kind and b.total is not null )
(select isnull(sum(cishu),0)
from b where kind=a.kind
group by kind)