Reputation: 11
How to copy all rows in one field with full replacement?
anna2 - database exp_weblog_data - table field_id_2 - fields
to
anna1 - database exp_channel_data - table field_id_2 - fields
exp_weblog_data and exp_channel_data have the same relationship between fields entry_id and field_id_2.
before:
exp_channel_data (from anna1) exp_weblog_data (from database anna2)
entry_id field_id_2 entry_id field_id_2
988 blabla 988 doomdoom
989 kryakrya 989 roomroom
... ...
after:
exp_channel_data exp_weblog_data
entry_id field_id_2 entry_id field_id_2
988 doomdoom 988 doomdoom
989 roomroom 989 roomroom
... ...
Upvotes: 0
Views: 90
Reputation: 41428
Assuming database server is mysql and both databases (anna2 and anna1) is on it AND you have proper credentials to connect to both, you can do a cross db update/select.
It looks like you're trying an update, not a creation of new records rom
UPDATE anna1.exp_channel_data a1, anna2.exp_weblog_data a2
SET a1.field_id_2 = a2.field_id_2
WHERE a1.id = a2.id;
The cross DB insert would be similarly done.
Upvotes: 1