在 phpmyadmin 中将表的一列迁移到另一个表的列


Migrate one column of a table to another table's column in phpmyadmin

field_data_body
+----------+---------------------+
| entry_id | body_value          |
+----------+---------------------+
|  1009    | content             |
+----------+---------------------+
|  1020    |                     |
+----------+---------------------+
|  1025    | more content        |
+----------+---------------------+

i_posts
+------+---------------+
|  id  |     html      |
+------+---------------+
| 1009 |               |
+------+---------------+
| 1020 |               | 
+------+---------------+
| 1025 |               | 
+------+---------------+

i_posts
+----------+---------------------+
| id       | html                |
+----------+---------------------+
|  1009    | content             |
+----------+---------------------+
|  1020    |                     |
+----------+---------------------+
|  1025    | more content        |
+----------+---------------------+

嗨,我正在尝试将body_value列转移到html列中,但不确定如何执行此操作。我有一个名为i_posts的表,我有我尝试转移的帖子的所有 ID。但是,在field_data_body表中,它没有每个entry_id的内容。有没有办法在保持正确id的同时将body_value移动到 html 列中?感谢您提前提供任何帮助!! -布莱克

编辑:这就是你所需要的。

UPDATE i_posts AS i, field_data_body AS f SET i.html = f.body_value WHERE i.id =f.entry_id

我写了一篇关于它的小帖子。