Hello!
Been googling, testing and searching for hours to no avail…I’m hoping someone here can help me with what I presume is a fairly simple SQL command, but I’m very basic about it and just getting errors.
My situation is as follows:
I need to take certain row data from wp\_postmeta table and stuff it into certain row data into wp\_posts. I’m migrating some 50,000 orders from drupal to wordpress, but due to weirdness, order #’s don’t match up.
What I am looking to do is copy the **meta\_value** in the **wp\_postmeta table**, but only where **meta\_key** LIKE “**\_fgd2wp\_old\_uc\_order\_id**”
Then take this specific query and dump it into **wp\_posts** table, into the **ID** column, but only where **post\_type** LIKE **shop\_order.**
​
I can find the data I want through the below search queries…but unsure how to copy. Tried and failed. Any help would be greatly appreciated. Thanks!
[SELECT](http://localhost/phpMyAdmin5/url.php?url=https://dev.mysql.com/doc/refman/5.7/en/select.html) \`meta\_value\` FROM \`wp\_postmeta\` WHERE \`meta\_key\` [LIKE](http://localhost/phpMyAdmin5/url.php?url=https://dev.mysql.com/doc/refman/5.7/en/string-comparison-functions.html#operator_like) ‘%old\_uc\_order\_id%’ [SELECT](http://localhost/phpMyAdmin5/url.php?url=https://dev.mysql.com/doc/refman/5.7/en/select.html) \`ID\` FROM \`wp\_posts\` WHERE \`post\_type\` [LIKE](http://localhost/phpMyAdmin5/url.php?url=https://dev.mysql.com/doc/refman/5.7/en/string-comparison-functions.html#operator_like) ‘shop\_order’ [ad_2]
So, the `wp_post` table rows would already have an `ID`?
Also, your second query should be an `UPDATE` and the `WHERE` clause uses the result of your first query. So, you should be researching MySQL’s `UPDATE` statement.
Do you have phpmyadmin?