UPDATE AKUZ.T_MEDICAL_RECORD mr
SET MedicalEpisode = di.MedicalExaminationData
FROM AKUZ.T_DISPANSERISATION_INIT di
WHERE mr.MedicalRecordID = di.MedicalRecordID
    AND di.MedicalExaminationData IS NOT NULL;

UPDATE AKUZ.T_MEDICAL_RECORD mr
SET MedicalEpisode = nme.MedicalEpisode
FROM AKUZ.T_NURSE_MEDICAL_EXAMINATION nme
WHERE nme.MedicalRecordID = mr.MedicalRecordID
    AND nme.MedicalEpisode IS NOT NULL;
