I have a table with product descriptions, and each product description has a product_id
and a language_id
. What I want to do is update all of the fields with a language_id
of 2
to be equal to the same product_id
where the language_id
is 1
.
So far I've tried the following query, but I'm getting errors indicating that MySQL doesn't want to update a table where the table's also being used in the subquery.
UPDATE
products_description AS pd
SET
pd.products_seo = (
SELECT
pd2.products_seo
FROM
products_description AS pd2
WHERE
pd2.language_id = 1
AND pd2.products_id = pd.products_id
)
WHERE
pd.language_id <> 1
Is there a "simple" way around this limitation in MySQL? Or any "tricks"? I'm a little surprised that my query doesn't work, as it seems logical.