第一道题:update yhdang set hfhj=b.m
from
yhdang a,
(
select b.bh,m=(select sum(hfhj) from hdmx200409 a where a.dh=b.dh)
from yhdang b
) b
on a.dh=b.dh第二道题:select * into yhdang_tmp from yhdang where 1<>1
from
yhdang a,
(
select b.bh,m=(select sum(hfhj) from hdmx200409 a where a.dh=b.dh)
from yhdang b
) b
on a.dh=b.dh第二道题:select * into yhdang_tmp from yhdang where 1<>1
from yhdang yh,(select dh,sum(hfadd) as hfadd from hdmx200409 group by dh) hdmx where yh.dh=hdmx.dh