Sql server update multiple columns from another table

后端 未结 4 1689
情歌与酒
情歌与酒 2021-02-19 17:57

I have read lots of post about how to update multiple columns but still can\'t find right answer.

I have one table and I would like update this table from another table.

4条回答
  •  深忆病人
    2021-02-19 18:14

    The above solution will work only for MSSQL. In case of MySql you just need to first declare the tables

    UPDATE 
          table1 t1 ,table2 t2 
    set 
          t1.field=t2.field 
    where 
          t1.id=t2.id;
    

    In my case this worked..!!

提交回复
热议问题