Copy data from one column to other column (which is in a different table)

后端 未结 8 1520
小鲜肉
小鲜肉 2020-11-30 20:59

I want to copy data from one column to another column of other table. How can I do that?

I tried the following:

Update tblindiantime Set CountryName          


        
8条回答
  •  一整个雨季
    2020-11-30 21:43

    Here the query:

    Same Table:

    UPDATE table_name 
    SET column1 = column2
    

    Different Table:

    UPDATE table_name1 
        SET column1 = (
            SELECT column2
            FROM table_name2
            WHERE table_name1.id = table_name2.id
        );
    

提交回复
热议问题