#1062 - Duplicate entry '23933-27243-2' for key 'membersid'

  • basketmen
  • Student
  • Student
  • No Avatar
  • Joined: Mar 21, 2007
  • Posts: 66
  • Status: Offline

Post November 20th, 2011, 10:40 am

Hi guys,

I have a table, the table name is account,
its have 2 fields : membersid, and categoryid



i want to change the categoryid field content, i run this in phpmyadmin :

Quote:
update `account` set categoryid = replace (categoryid, '1' , '2');




but get this error message

Quote:
#1062 - Duplicate entry '23933-27243-0' for key 'membersid'









- what should i do so i can change the field content? Please help.
I already tried changing the field TYPE, from INT, to BIGINT, like other person suggested, but still get that error message

- this is the screenshot from the field Structure

Image
  • Anonymous
  • Bot
  • No Avatar
  • Joined: 25 Feb 2008
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post November 20th, 2011, 10:40 am

  • gisele
  • Expert
  • Expert
  • User avatar
  • Joined: Nov 11, 2004
  • Posts: 583
  • Loc: Nimes (France)
  • Status: Offline

Post January 10th, 2012, 3:07 pm

Hi,

It seems you try to violate a "unique" constraint, you should check "membersid" key definition.
are you sure you have put your key (primary key?) on the right field(s)?
Moreover, you stament looks very strange when applied to integers unless you really want what it will do.
It means :
"I want to repalce every digit =1 by 2 within field values".
For example 12 will change to 22.
wich isn't the same as
update `account` set categoryid = '2' where categoryid = '1';
wich means "if field value = 1 so put 2 instead".
____________________
My web site[/url] oh sh..!

Post Information

  • Total Posts in this topic: 2 posts
  • Users browsing this forum: No registered users and 111 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© 2011 Unmelted, LLC. Ozzu® is a registered trademark of Unmelted, LLC.