The background:
- Table wp_commentmeta contains columns: country, city, continent and comment_id.
- Table wp_comments contains columns: comment_ID, comment_post_ID and user_id.
- I custom created a table named wp_combined with columns: country, city, continent and user_id.
I would like to copy country, city, continent, user_id and comment_post_ID to the newly custom created table wp_combined. This requires to associate the wp_commentmeta fields of country, city and continent with the user_id and comment_post_ID in wp_comments.
My code so far:
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
How can I do this? Thank you, friends.