I have the following tables
and I want to update table Contacts, so that the field companyId will be newCompanyId in table2.
I've tried the following query:
SET contacts.companyId = table2.newComapnyId
INNER JOIN table2
ON contacts.contactId = table2.conatctId
In most RDMS you don't have to specify the FROM-clause as it's already included in the statement. Try this:
UPDATE contacts c INNER JOIN table2 t ON c.contactId = t.conatctId SET c.companyId = t.newComapnyId