in reply to Checking for Dupes in MySQL

If you make email address a primary key on the table storring the information in mysql, it will prevent dups. This may have other effects (performance, etc), i have only used mysql once, so i am not sure. Also, once you do this it will actually error when you try to insert new rows, so it makes it trickier to do inert error checking.

Also, a word of caution, to prevent dup emailing, normalize the email addresses before you load them. This may seem silly, but the RFC allows for the same email address to be written a million ways (well, nearly infinte if you think about number of character/position combonations).

you could also query the whole table out into a hash.BUT i do NOT suggest that ... talk about missing the scalability bus.
i had a memory leak once, and it ruined my favorite shirt.

Replies are listed 'Best First'.
Re: Re: Checking for Dupes in MySQL
by hakkr (Chaplain) on Nov 29, 2001 at 17:47 UTC
    SELECT DISTINCT $field FROM $table

    Will omit all duplicate values occurring in field

      SELECT DISTINCT will only prevent you from seeing duplicates. It will not prevent duplicates from being inserted.