Wordpress MySQL:将表格(commentmeta和comments)中的字段复制到新表中

时间:2015-06-22 15:22:26

标签: mysql wordpress

背景:

  • wp_commentmeta 包含以下列:国家城市大陆 comment_id
  • wp_comments 包含以下列: comment_ID comment_post_ID user_id
  • 我自定义创建了一个名为 wp_combined 的表,其中包含以下列: country city continent USER_ID

我想将country,city,continent,user_id和comment_post_ID复制到新自定义创建的表wp_combined。这需要将country,city和continent的wp_commentmeta字段与wp_comments中的user_id和comment_post_ID相关联。

到目前为止我的代码:

USE wp_database;
INSERT into wp_combined (country, city, continent, comment_post_id, user_id)     
                        /* note above are the only fields required to copy) */
SELECT country, city, continent, comment_post_id, user_id FROM wp_commentmeta, wp_comments

我该怎么做?谢谢你,朋友们。

0 个答案:

没有答案