in MySQL

Update one table with data from another table (mysql)

1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading...

Updating one table with data from another table

For MySql:

UPDATE table1 JOIN table2
ON table1.id = table2.id
SET table1.firstname = table2.firstname,
table1.`lastname` = table2.`lastname`

For Sql Server:

UPDATE table1
SET table1.firstname = table2.firstname,
table1.[lastname] = table2.[lastname]
FROM table1 JOIN table2
ON table1.id = table2.id

Related Posts

Add a Comment

Your email address will not be published. Required fields are marked *