Forum Moderators: coopster

Message Too Old, No Replies

How Do I Get MySQL To Ignore Duplicate Entries?

         

deeanne59

3:56 am on Aug 11, 2004 (gmt 0)

10+ Year Member



I am finally able to load my files into my database tables, but I am now getting "duplicate entry" error messages. My datafeed will have an entry "blond haired boy...." and "blond haired girl....." It is picking up the "blond haired..." as a duplicate entry. I have tried changing my primary key to SKU, product name, etc. - but I keep getting this message (and I am SOOOO close to getting this file uploaded!
:)

digitalv

4:32 am on Aug 11, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



A SQL database wouldn't consider a portion of a field as duplicate content - duplicates only take place when the ENTIRE field matches one in the database. "blonde haired boy" will never error out because "blonde haired girl" exists.

There must be another column in addition to that one that exists already - take a closer look at your INSERT statements and data already in the database to see what else it could be.

deeanne59

6:12 am on Aug 11, 2004 (gmt 0)

10+ Year Member



Thanks DigitalV. I will try to see if I can find the culprit. I was within 20 records of having my first database table populated! I have been trying to get this far for a while. Now, hopefully, I can fully create my first database driven website.

timster

12:55 pm on Aug 11, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Just a stab in the dark, but maybe your duplicate value may be '' (empty field). That one stumps a lot of first-timers.

You may have more luck creating a very lenient table, and then trying to add constraints later.

deeanne59

5:58 pm on Aug 11, 2004 (gmt 0)

10+ Year Member



Thanks Timster. I did notice that some fields in the datafeed have blank cells...and I included them in my database because of the info in the full cells. I forgot to make those columns as "null" or whatever...to be more forgiving of the blank spots.