pheromix pheromix - 1 year ago 37
MySQL Question

How to insert records from a database into another database table?

I have two

and I want to
the results of a
from the first
into another table in the second
. How to do that using MySQL ?

Answer Source

If both databases are on same system you may try something like, In the below example data is migrated from oldDatabase table1 to newDatabase table1. This is the basic example, you can do your variation of query with it.

INSERT INTO newDatabase.table1 (column1, column2) 
SELECT column1, column2 FROM oldDatabase.table1;