How to update a MySQL table with fresh data currently in Excel?

It was easy using phpMyAdmin to pull a list of WordPress admin comments that were missing an IP location, but now that I’ve got that data in hand I’m looking for a quick way to insert it into the table. My guess is that’ll probably be the use (upload) of a .sql file.

» WordPress ERD

Read More

I’ve currently got my fresh data in an Excel sheet, with columns for comment_ID and comment_author_IP. There are several hundred records, with a variety of IP addresses.

UPDATE:

The winning query:

UPDATE wp_comments x, temp xx
SET x.comment_author_IP = xx.IP
WHERE x.comment_ID = xx.ID;

Related posts

Leave a Reply

1 comment

  1. If you are looking into a manual and easy process

    • Use phpMyAdmin to upload your Excel to a new table. (it can import Excels too);
    • add some indexes on foreign keys on the new created table;
    • then join the new table with the actual table and update the relevant fields.