There are a couple of questions asked at SO similar like this but I have followed them but no luck.
I am trying to update my wordpress posts
table column from postmeta
value.
posts
table
| ID | ... | order_date |
|----|-----| ------------------ |
| 1 | ... | 2019-07-01 08:10:00|
I need to update this new order_date
column from old meta_value
data.
I have followed these questions and answers.
mysql update column with value from another table
MySql Update one table from another fails
UPDATE posts
SET posts.order_date= ( SELECT meta_value FROM postmeta WHERE post_id = posts.ID AND meta_key = 'order_date' )
WHERE post_type = 'orders'
LIMIT 1000
AND
UPDATE posts
SET posts.order_date = (
SELECT meta_value
FROM postmeta
WHERE post_id = posts.ID
AND meta_key = '_order_date'
)
WHERE post_type = 'orders' AND order_date IS NULL
But no luck '0 Rows affected'.
Hope someone can help me.
Thank you