command using UPDATE and JOIN produces error

Viewed 14

I'm trying to update a table using JOIN. I have a mapping table with 2 columns: id and newId.

Now i want to replace the ids of another table using this mapping. Following various examples from the web, I tried:

UPDATE 
    Users 
SET 
    Users.id = Mapping.newId 
FROM 
    Users 
    INNER JOIN Mapping ON Users.id = Mapping.id;

But i get the error

#1064 - You have an error in your SQL syntax;... at line 5

0 Answers
Related