Try one of these. I think these are logically equivalent to your queries, but please examine and test to see if they really are:UPDATE b SET
id_part_number = a.ID
FROM
a_stg_value_descrription b
INNER JOIN a_stg_PartNumber a ON
a.attribute_id = b.attribute_id;
;WITH cte AS
(
SELECT DISTINCT
b.id_part_number,
a.ID
FROM
a_stg_value_descrription b
INNER JOIN a_stg_PartNumber a ON
a.attribute_id = attribute_id
)UPDATE cte SET id_part_number = id;