How to update only one column of sql table by csv file

后端 未结 2 1506
南方客
南方客 2021-01-26 11:09

I have a csv file containg some data. And in my Sql Database I have a table with multiple column name. Now I want to update only one column by csv file. Thanks

相关标签:
2条回答
  • 2021-01-26 11:42

    You can try like this:

    -Import the csv file to a temp table
    -Update your main table by joining with a temp table.
    
    0 讨论(0)
  • 2021-01-26 11:56

    As stated by the MySQL Documentation you can do this

    LOAD DATA INFILE 'mycsvdata.csv'
    INTO TABLE mytable
    ( @csvfield1, @csvfield2 )
    SET myTabField = @csvfield2;
    
    0 讨论(0)
提交回复
热议问题