I'm working on copying some data from one db to another. The sql I've written (INSERT INTO SELECT FROM) works but on record 19 it says
'' duplicate entry for key 2.
The next record is 20 not '' in the table I'm copying from. I'm confused on why this is happening and how do I fix it or work around it.
Any ideas?
Thanks 0 plenty!
INSERT INTO... SELECT.... FROM
Moderator: General Moderators
Sure
I'll post it....
Code: Select all
INSERT INTO mad_users ( username, pwd, firstname, lastname, email) SELECT ddl_user.username, ddl_user.password, ddl_user.firstname, ddl_user.lastname, ddl_user.email FROM ddl.ddll_userThere is only one key in each table. In both cases it's the 'id' field. I dropped them from the query because in both cases the are also auto_incrementing. The table I'm copying from has about 40 records and I checked the numbers to make sure they are sequential and that they are all there. It checked out.