Update data sheets and data sheets directly with sql? The number of databases that make my balls hurt.

the starting point is the article ID , which is assumed to be 123
. Now I want to find a match post_id = 123 , and then match meta_key = _ thumbnail_id and meta_value = 456
and then use the ID of 456 to find the ID, of wp_posts data table.

data sheet wp_postmeta

post_id / meta_key / meta_value
123 / _thumbnail_id / 456

data sheet wp_posts (the value I want)

ID / guid
456 / guid

data sheet wp_posts (go back to replace the article)

ID / guid
123 / guid

it"s a bit awkward, but I really don"t know how to update the table
what I want to update is the same data table, the same bit, but a different ID
the whole thing is dead.

, but I really don"t know how to update the table.

I want to update the same table, the same bit, but a different ID
the whole thing is dead.

I wrote something like this

UPDATE wp_posts
SET posts.guid = posts.guid 
FROM wp_posts posts
INNER JOIN wp_postmeta meta
ON meta.meta_key = "_thumbnail_id"
WHERE meta.post_id = posts.ID

report:

-sharp1064 - You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near "FROM wp_posts posts
INNER JOIN wp_postmeta meta 
ON meta.meta_key = "_thumbnai" at line 3

PS I didn"t write this database. I want to send the data to me. I need to check and organize the data first


UPDATE `wp_posts` a, `wp_posts` b, `wp_postmeta` c
SET a.`guid` = b.`guid`
WHERE c.`post_id` = 123
    AND c.`meta_key`='_thumbnail_id'
    AND b.`id` = c.`meta_value`
    AND a.`id` = c.`post_id`;
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e85277-d36.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e85277-d36.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?