update stor
set stor.EhrRusMdr308 = pharm.EhrRusMdr308
from stor.T_STORAGE stor
join APS.T_PHARMACY_ISSUE_PLACE pharmacy_ip on stor.IssuePlace = pharmacy_ip.IssuePlaceId
join APS.T_PHARMACY pharm on pharm.Code = pharmacy_ip.Pharmacy
go