update [Pro_Products] set MaxRatio=b.maxRate,MinRatio=b.minRate,MaxTerm=b.maxTerm,minTerm=b.minTerm
from Pro_Products A,
(select MAX(Term) as maxTerm,MIN(term) as minTerm,MAX(YieldRate) as maxRate,MIN(YieldRate)as minRate,ProductId
from Pro_YieldRate group by ProductId) B
where A.Id=B.ProductId and B.ProductId in
(select ProductId from inserted union select ProductId from deleted )
阅读(1102) | 评论(0) | 转发(0) |