Re: Finding Duplicate Numbers?
| From: | Mark Maggelet | Date: | Tue, 17 Apr 2001 19:41:12 +0000 |
| Subject: | Re: Finding Duplicate Numbers? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-49034@lists.php.net to get a copy of this message | ||
On Tue, 17 Apr 2001 12:34:27 -0700, Colin Putney
(cputney@whistler.net) wrote:
>On Tuesday, April 17, 2001, at 12:19 PM, Mark Maggelet wrote:
>
>> That works for mysql. He probably just wants to kill the
>>duplicates,
>> so there's an easier way: add a unique index to the phone_number
>> field.
>>
>> alter ignore table $table add unique (phone_number);
>
>Yep, that will prevent duplicate phone numbers from being inserted
>into
>the table.
>
>Note that if there is existing data in the table, he'll have to
>remove
>the duplicates before making the phone_number field unique.
That would be true if I left out the 'ignore'. The way it is here it
will automatically toss the duplicates.
- Mark