Reputation: 13
I have two databases db1 and db2 on the same mysql server. From table1 belonging to db1 I want to copy column1 to column2 in table2 belonging to db2. How is this accomplished?
Upvotes: 0
Views: 1731
Reputation: 366
is there a common key between the two tables? ie, db1.table1.id = db2.table2.id? if so, and you have an account that has access to both databases & tables, the following should work:
UPDATE db1.table1 AS a, db2.table2 AS b SET b.column2 = a.column1 WHERE a.id = b.id;
Upvotes: 1