UPDATE akuz.t_state_address sa
SET Street = s.StreetID
FROM akuz.t_street s
WHERE sa.KladrCode = s.Code;

UPDATE akuz.t_state_address sa
SET District = s.District
FROM akuz.t_street s
WHERE sa.Street = s.StreetID;

UPDATE akuz.t_state_address sa
SET City = s.City
FROM akuz.t_street s
WHERE sa.Street = s.StreetID;

UPDATE akuz.t_state_address sa
SET District = d.DistrictID
FROM akuz.t_district d
WHERE sa.KladrCode = d.Code;

UPDATE akuz.t_state_address sa
SET City = d.City
FROM akuz.t_district d
WHERE sa.District = d.DistrictID AND sa.City IS NULL;

UPDATE akuz.t_state_address sa
SET City = c.CityID
FROM akuz.t_city c
WHERE sa.KladrCode = c.Code;