0

I need to take values from an old database to a new one. Specifically a plugin's meta value of WooCommerce products. I've got the same products data in both tables but the IDs are not coincident, so the only common column is SKU, which is a meta_value of wp_postmeta table with meta_key = '_sku'

The values from the old database are:

db1.wp_postmeta: meta_key = sku - meta_value = 'xxxx1'

on the new database I need to update:

db2.wp_postmeta:

when meta_key = sku

if meta_value = db1.meta_value (xxxx1)

then UPDATE meta_key = 'plugin_data'

SET meta_value = (db1.meta_value when db1.meta_key ='plugin_data')

It's really hard for me to explain and to get the data I need, because WP stores all the data in key/value pairs on the same table.

Thank you in advance for your help

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.