我想用这个查询中的值进行更新,但它说的是错误……我正试图将它最小化。
update p
set a10=t.sumgc
from temp as p inner join
(SELECT SUM(gcsanad) as sumgc,good_gr
fROM dbo.fgoodgroup
WHERE (flag = 2)
group by good_gr ) as t
on t.good_gr=p.a3
,
a11=t.sumgc
from temp as p inner join
(SELECT SUM(gcsanad) as sumgc,good_gr
fROM dbo.fgoodgroup
WHERE (flag = 4)
group by good_gr ) as t
on t.good_gr=p.a3