我有表 t1。
table t1
id post_id tags
1 null a
2 1 null
3 1 null
4 null b
我想更新 post_id = id 的标签。 我尝试了一个查询,它给了我零输出。
当标签存在时post_id始终为空,当post_id存在时标签始终为空
update t1 set tags = tags where post_id = id;
你们能帮我正确地构图吗?请帮助我
最佳答案
在 a.id = b.post_id set b.tag = a.tag 上更新 t1 a join t1 b
关于mysql - 从同一表列更新列,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16729415/