If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > MySQL > indexes, duplicate entries?

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 08-16-04, 15:39
Matrix28 Matrix28 is offline
Registered User
 
Join Date: Sep 2003
Posts: 47
indexes, duplicate entries?

I am trying to create an index for one of my databases but it keeps saying there are duplicated entries. How can I 'ignore' then and continue to create the index?
Reply With Quote
  #2 (permalink)  
Old 08-17-04, 20:21
yellowmarker yellowmarker is offline
Registered User
 
Join Date: Jul 2004
Location: Dundee, Scotland
Posts: 107
my understanding is that in MySQL an index field has to contain unique values. you should remove any duplicate keys before adding the index, or the following statement would create the index, ignore errors, deleting duplicate rows automatically!

ALTER IGNORE TABLE table_name ADD UNIQUE INDEX(field_name);

http://mysql.mirror.nedlinux****/doc/...ATE_INDEX.html

if this is not appropriate, then you are looking have an index field with duplicate values. I don't know that answer.
Reply With Quote
  #3 (permalink)  
Old 08-17-04, 21:35
anacedent anacedent is offline
Registered User
 
Join Date: Aug 2003
Location: Where the Surf Meets the Turf @Del Mar, CA
Posts: 6,413
Don't insert duplicate records or don't make the index UNIQUE.
__________________
You can lead some folks to knowledge, but you can not make them think.
The average person thinks he's above average!
For most folks, they don't know, what they don't know.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On