UPDATE User,temp_table,Country SET ID_country = Countries.ID WHERE User.ID = temp_table.ID AND temp_table.Country = Countries.Country