Hi, 1st off thanks for looking at this issue.
I have two databases that have the same structure and I want to be able to merge the databases together however im getting a duplicate key error.
I'm trying, insert into squirrelmail_merged.address select * from squirrelmail.address; but im getting the following error, ERROR 1062 (23000): Duplicate entry 'test-test' for key 1.
I tried various "on duplicate key" syntax but i cant seem to figure it out. If someone can let me know what i can do to merge the 2 DB's and have the unique keys for the db im importing changed that would be great.
TIA, P
below is the table structure, both DBs are identical.
I have two databases that have the same structure and I want to be able to merge the databases together however im getting a duplicate key error.
I'm trying, insert into squirrelmail_merged.address select * from squirrelmail.address; but im getting the following error, ERROR 1062 (23000): Duplicate entry 'test-test' for key 1.
I tried various "on duplicate key" syntax but i cant seem to figure it out. If someone can let me know what i can do to merge the 2 DB's and have the unique keys for the db im importing changed that would be great.
TIA, P
below is the table structure, both DBs are identical.
Code:
mysql> show tables;
+-------------------------------+
| Tables_in_squirrelmail_merged |
+-------------------------------+
| address |
| userprefs |
+-------------------------------+
2 rows in set (0.00 sec)
mysql> describe address;
+-----------+--------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+-----------+--------------+------+-----+---------+-------+
| owner | varchar(128) | | PRI | | |
| nickname | varchar(16) | | PRI | | |
| firstname | varchar(128) | | MUL | | |
| lastname | varchar(128) | | | | |
| email | varchar(128) | | | | |
| label | varchar(255) | YES | | NULL | |
+-----------+--------------+------+-----+---------+-------+
6 rows in set (0.00 sec)
mysql> describe userprefs;
+---------+--------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+---------+--------------+------+-----+---------+-------+
| user | varchar(128) | | PRI | | |
| prefkey | varchar(64) | | PRI | | |
| prefval | blob | | | | |
+---------+--------------+------+-----+---------+-------+
3 rows in set (0.00 sec)