【发布时间】:2016-01-24 07:48:39
【问题描述】:
我正在使用 MySQL 认为 phpMyAdmin 的数据库工作,重要的是要知道我对 MySQL 的了解非常有限。
我的数据库中有两个表。我需要在第二个表(wp_posts_thumbs)中取img_id列的值,在第一个表(wp_posts)中找到匹配对,在第一个表的ID列中取对应的值,插入到第二个表中的post_parent 列。
这是第一个表 (wp_posts) 的样子:
+------+-------------------------+
| ID | img_id |
+------+-------------------------+
| 1 | W048zewxemq1tw0810aiec |
| 2 | W0481l2lv4npdczok5mmucl |
| 3 | W0481j9w7fg80b8gkiida85 |
+------+-------------------------+
这是第二个表 (wp_posts_thumbs) 的样子:
+------+-------------------------+-------------+
| ID | img_id | post_parent |
+------+-------------------------+-------------+
| 101 | W048zewxemq1tw0810aiec | 0 |
| 102 | W0481l2lv4npdczok5mmucl | 0 |
| 103 | W0481j9w7fg80b8gkiida85 | 0 |
+------+-------------------------+-------------+
提前谢谢各位:)
【问题讨论】:
-
你不应该也发布你的第三张表(post_parent)吗?
-
没有第三个表,伙计:/
post_parent是位于wp_posts_thumbs表中的第三列,就像我在消息内容中说明的那样。 -
抱歉误读了您的问题
标签: mysql phpmyadmin string-matching multiple-tables