Hello and welcome to our community! Is this your first visit?
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New Coder
    Join Date
    Mar 2007
    Thanked 0 Times in 0 Posts

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

    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 :

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

    but get this error message

    #1062 - Duplicate entry '23933-27243-2' 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

    Last edited by basketmen; 11-20-2011 at 08:02 PM.
    Whats up

  • #2
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Thanked 4,741 Times in 4,703 Posts
    Don't show the field info. Show the entire table's info, including the indexes.

    I would guess that you have a composite key defined on that table and indeed when you tried to change the category from 1 to 2 you managed to create a duplicate composite key.

    Try issuing the command
    DESCRIBE TABLE account;
    and if you can't figure out what it shows you, show the result to us.
    An optimist sees the glass as half full.
    A pessimist sees the glass as half empty.
    A realist drinks it no matter how much there is.


    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts