In mysql i have 2 table.
First
- wp_postmeta_import
Second
- wp_postmeta_temp
These tables have these columns:
- meta_id
- post_id
- meta_key
- meta_value
I need to update only my column meta_value of wp_postmeta_temp when post_id is egual to post id of wp_postmeta_import and the value of meta_key is _variation_description because in table are other post_id with other value
i try some code an this is the only that work a little bit but it is change the row that i need and in the other meta_key it gives me NULL.
UPDATE wp_postmeta_temp
SET meta_value = (
SELECT
meta_value
FROM
wp_postmeta_import
WHERE
wp_postmeta_import.post_id = wp_postmeta_temp.post_id
AND
wp_postmeta_temp.meta_key = '_variation_description'
);
The table have rows, for any post_id for exemple:
- meta_id: variable (82649,82650..)
- post_id: 5065
- meta_key: _variation_description or _regular_price or total_sales ecc..
- meta_value: variable (15, 0, 200 ...)
i hope that i'm clear anyone can help me, please?