hello friends
update mkf set mkf.Score= mkf.score -
(
select sum(pp.ScoreInScale) from Progresses pp
where pp.MemberKnowledgeFieldId = mkf.Id
and pp.KnowledgeId in
(select k.KnowledgeId from knowledges k where k.Code in
(
8396
,8395
,7999
,7723
,7751
,7753
,8069
,362
,7733
,7993
,8379
,7736
)
)
)
FROM NewKms_MECO..MemberKnowledgeFields mkf
where mkf.Id in
(select p.MemberKnowledgeFieldId from Progresses p
where p.KnowledgeId in
(
select k.KnowledgeId from knowledges k where k.Code in
(
8396
,8395
,7999
,7723
,7751
,7753
,8069
,362
,7733
,7993
,8379
,7736
)
)
)