SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Guru
    Join Date
    Sep 2004
    Location
    Provo, UT
    Posts
    858
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    Cryptic error message baffles me

    I have a column called author that is set to null for all rows. When I try to drop the column using phpMyAdmin, I get the following error. Any ideas?

    Thanks!


    #1062 - Duplicate entry 'shingles-keyword' for key 'author'
    Convert your dollars into silver coins. www.convert2silver.com

  2. #2
    SQL Consultant gold trophysilver trophybronze trophy
    r937's Avatar
    Join Date
    Jul 2002
    Location
    Toronto, Canada
    Posts
    39,273
    Mentioned
    60 Post(s)
    Tagged
    3 Thread(s)
    could you do a SHOW CREATE TABLE please?

    i don't understand how dropping a column would create a duplicate entry

    have you tried the actual SQL to do that task, instead of the phpmyadmin gui?
    Code:
    ALTER TABLE tablename DROP COLUMN columnname
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL
    "giving out my real stuffs"

  3. #3
    SitePoint Guru
    Join Date
    Sep 2004
    Location
    Provo, UT
    Posts
    858
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Yes, I tried the actual SQL and got the same weird error.


    CREATE TABLE `searches` (
    `sID` int(7) NOT NULL AUTO_INCREMENT,
    `searchDate` datetime DEFAULT NULL,
    `uID` int(11) DEFAULT NULL,
    `author` mediumint(4) DEFAULT NULL,
    `type` varchar(8) DEFAULT NULL,
    `keyword` varchar(35) DEFAULT NULL,
    `results` smallint(4) DEFAULT NULL,
    `alerts` mediumint(3) DEFAULT '0',
    `lastAlert` datetime DEFAULT NULL,
    `clicks` mediumint(3) DEFAULT '0',
    `lastClick` datetime DEFAULT NULL,
    `timeStamp` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
    PRIMARY KEY (`sID`),
    UNIQUE KEY `author` (`author`,`keyword`,`type`),
    FULLTEXT KEY `keyword` (`keyword`)
    ) ENGINE=MyISAM AUTO_INCREMENT=489807 DEFAULT CHARSET=latin1
    Convert your dollars into silver coins. www.convert2silver.com

  4. #4
    SQL Consultant gold trophysilver trophybronze trophy
    r937's Avatar
    Join Date
    Jul 2002
    Location
    Toronto, Canada
    Posts
    39,273
    Mentioned
    60 Post(s)
    Tagged
    3 Thread(s)
    drop the unique key before you try to drop the column
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL
    "giving out my real stuffs"

  5. #5
    SitePoint Guru
    Join Date
    Sep 2004
    Location
    Provo, UT
    Posts
    858
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Thanks Rudy!
    Convert your dollars into silver coins. www.convert2silver.com


Bookmarks

Posting Permissions

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