update otc
set otc.OutcomeOfInspection = me.OutcomeRecord
from AKUZ.T_ONK_TREATMENT_CASE otc
join akuz.T_MEDICAL_EPISODE me on me.MedicalEpisodeID = otc.MedicalEpisode
left join AKUZ.T_ONK_TREATMENT_CASE otcOld on otcOld.OutcomeOfInspection = me.OutcomeRecord
where otc.OutcomeOfInspection is null and me.OutcomeRecord is not null and otcOld.OnkTreatmentCaseID is null