UPDATE mr
SET mr.MedicalEpisode = di.MedicalExaminationData
FROM AKUZ.T_MEDICAL_RECORD mr
JOIN AKUZ.T_DISPANSERISATION_INIT di on mr.MedicalRecordID = di.MedicalRecordID
WHERE di.MedicalExaminationData is not null
GO

UPDATE mr
SET mr.MedicalEpisode = nme.MedicalEpisode
FROM AKUZ.T_MEDICAL_RECORD mr
JOIN AKUZ.T_NURSE_MEDICAL_EXAMINATION nme on nme.MedicalRecordID = mr.MedicalRecordID
WHERE nme.MedicalEpisode is not null
GO