Hi,
I have a table that looks like:
CREATE TABLE `message_inbox` (
  `member_id` mediumint(8) unsigned NOT NULL default '0',
  `message_id` int(10) unsigned NOT NULL default '0',
  `new` enum('y','n','replied') NOT NULL default 'y',
  `datetime` datetime default NULL,
  KEY `idx_1` (`member_id`,`new`),
  KEY `idx_2` (`member_id`,`datetime`)
) TYPE=InnoDB


Now, I want to add a primary key to it.
ALTER TABLE message_inbox ADD PRIMARY KEY (member_id, message_id)

But there are already some duplicated entries. 
ERROR 1062: Duplicate entry '10244-80871' for key 1

How can I tell MySQL to delete the duplicated entry and continue to make primary key? 
Is there any efficient way to do this? Thank you very much.

Regards,
bk

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to