Import Column from CSV into existing MySQL Table

前端 未结 1 1776
Happy的楠姐
Happy的楠姐 2021-01-13 21:32

I\'ve got a MySQL table Researcher :

ID | FirstName | Surname | Email | Position | Summary | ... + many more columns.


        
相关标签:
1条回答
  • 2021-01-13 22:25

    Thanks for pointing me in the right direction fancyPants.

    I eventually solved it like this:

    1. Created a new table in the DB called Researcher_Temp with columns from the CSV.
    2. Used phpMyAdmin to import the CSV using LOAD DATA into Researcher_Temp
    3. Ran the following query to add the summary data from Researcher_Temp into my main Researcher table:

    UPDATE Researcher INNER JOIN Researcher_Temp on Researcher_Temp.Email = Researcher.Email SET Researcher.Summary = Researcher_Temp.Summary;

    I then deleted the Temp table.

    0 讨论(0)
提交回复
热议问题