update a set a.BuyIndex=sum(b.SV1+b.SV2+b.SV3) from SumStock a left join SHSZ_FenBi b on a.CodeID=b.StockSymbol 这句报错:聚合不应出现在 UPDATE 语句的集合列表中。 请问正确的应该怎么写?谢谢!
--try update a set a.BuyIndex=b.SV from SumStock a left join (select sum(b.SV1+b.SV2+b.SV3) as SV from SHSZ_FenBi) b on a.CodeID=b.StockSymbol
update a set a.BuyIndex=b.SV from SumStock a left join (select StockSymbol,sum(b.SV1+b.SV2+b.SV3) as SV from SHSZ_FenBi group by StockSymbol) b on a.CodeID=b.StockSymbol
update a set a.BuyIndex=(select sum(b.SV1+b.SV2+b.SV3) from SHSZ_FenBi b where a.CodeID=b.StockSymbol ) from SumStock a
update a set a.BuyIndex=(select sum(SV1+SV2+SV3) from SHSZ_FenBi where StockSymbol=a.CodeID) from SumStock a
update a set a.BuyIndex= c.sum1 from SumStock a JOIN (select StockSymbol, sum(b.SV1+B.SV2+b.SV3) as sum1 from SHSZ_FenBi b) c ON a. CodeID=c.StockSymbol
update a set a.BuyIndex=b.SV from
SumStock a left join (select sum(b.SV1+b.SV2+b.SV3) as SV from SHSZ_FenBi) b on a.CodeID=b.StockSymbol
SumStock a left join (select StockSymbol,sum(b.SV1+b.SV2+b.SV3) as SV from SHSZ_FenBi group by StockSymbol) b on a.CodeID=b.StockSymbol
set a.BuyIndex=(select sum(b.SV1+b.SV2+b.SV3)
from SHSZ_FenBi b where a.CodeID=b.StockSymbol )
from SumStock a
set a.BuyIndex=(select sum(SV1+SV2+SV3) from SHSZ_FenBi where StockSymbol=a.CodeID)
from
SumStock a
(select StockSymbol, sum(b.SV1+B.SV2+b.SV3) as sum1 from SHSZ_FenBi b) c
ON a. CodeID=c.StockSymbol