Reputation: 49
I have two MySQL databases with similar sets of data, both on the same server. I need to grab select fields from a given table in database X and move them into given fields of a table in database Y. The table names are different, but field names are the same except for a prefix on database Y.
The database should be moved based on a unique username that exists on both ends. So I would get the data for username A, then find username A in database Y, and copy the data from the select fields for that user.
Any direction or advice would be much appreciated. This by the way would be a process to run as needed, not something that needs to continuously run. Using PHP 5.3 and MySQL 5.
Upvotes: 0
Views: 185
Reputation: 159
INSERT INTO database1.customer (
id
fname,
etc
)
SELECT
id
fname,
etc
FROM
database2.customer
Upvotes: 2