0

I need to update a column in a database with values from another column of another database.

Here is my query:

UPDATE dbA.tableA as a
SET a.columnA = b.columnB
FROM dbB.tableB as B
WHERE
a.num = b.num

And I get the error:

1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'FROM ...

Both databases are in the same server.

How can I solve this?

Community
  • 1
  • 1
Danilo
  • 382
  • 7
  • 23
  • possible duplicate of [mysql update join](http://stackoverflow.com/questions/15209414/mysql-update-join) – abl Dec 03 '14 at 19:25

1 Answers1

0

The correct format of update with join is

UPDATE dbA.tableA  a
join dbB.tableB b on a.num = b.num
SET a.columnA = b.columnB
Abhik Chakraborty
  • 44,654
  • 6
  • 52
  • 63