I am not sure why I am getting this error #1062 - Duplicate entry '1' for key 1 cany any one help explain what it means. Thanks
+2
A:
More than likely your column is set to be Unique, and you're trying to input a row with an ID that already exists in your table.
bradenkeith
2010-07-22 17:12:44
How would i fix that?
Webne
2010-07-22 19:03:53
Setting the column to auto_increment and not inserting a value when inserting the row (letting it auto populate) would be the best fix. Or you could see the last ID in your table though, and increment it by one for your value.
bradenkeith
2010-07-23 12:32:33
+3
A:
You are probably trying to insert a record with the ID (or some other field) 1
set, while such a record already exists in the table. The field that is the primary key must have a unique value for each record.
Pekka
2010-07-22 17:12:48
I am doing a drupal to wordpress conversion and when I get to this part of the conversionINSERT INTO lceating_wrdp1.wp_terms (term_id, `name`, slug, term_group)SELECT d.tid, d.name, REPLACE(LOWER(d.name), ' ', '-'), 0FROM wrdp1.term_data dINNER JOIN wrdp1.term_hierarchy h USING(tid) it throws this error #1062 - Duplicate entry '1' for key 1I set the primary key to be unique.
Webne
2010-07-22 18:53:34
@Webne you may have to set the key back to non-unique for the first import, or unset the IDs in the table you're copying from. Whether that is safe to do is impossible to tell without knowing the data.
Pekka
2010-07-22 20:20:39
+1
A:
I think you're trying to insert '1' to a unique key field that already has a '1' value
eiefai
2010-07-22 17:13:29
I am doing a drupal to wordpress conversion should i do a drop the table content and then try again?
Webne
2010-07-22 18:55:53
Hate to ask another question but, I dropped the table and started from scratch I am not getting the duplicate any more but I am getting this error #1062 - Duplicate entry 'lc-plans' for key 2 does that mean that I am trying to add two of the 'lc-plans' field?thanks
Webne
2010-07-22 19:37:57
yes, the error you are getting its the same (#1062) but in a different field, you shouls check the db schema of wordpress (constraints, primary keys, unique keys, etc.) before trying to insert data.
eiefai
2010-07-23 16:00:49