update select sql 1

update select sql

UPDATE YourTable 
SET Col1 = OtherTable.Col1, 
    Col2 = OtherTable.Col2 
    SELECT ID, Col1, Col2 
    FROM other_table) AS OtherTable
    OtherTable.ID = YourTable.ID

Here is what the above code is Doing:
1. Create a temporary table called OtherTable that contains the data you want to update.
2. Update YourTable with the data from OtherTable.
3. Delete the temporary table.

Similar Posts