I suppose the i could always remove the unique constraint once the alter 
statement has removed the duplicates.

ok

Paul DuBois wrote:

> At 18:13 -0400 5/10/02, Augey Mikus wrote:
>
>> so i suppose an automatic delete of every duplicate record is out of 
>> the question :-)
>
>
> Sounds like you're trying to have it both ways.
>
>>
>> Paul DuBois wrote:
>>
>>> At 18:00 -0400 5/10/02, Augey Mikus wrote:
>>>
>>>> is there a way for me to do it in a mysql delete statement?  just 
>>>> out of curiosity, for instance, if i wanted to add duplicates later 
>>>> for whatever reason.
>>>
>>>
>>>
>>> Okay, let's suppose you have 3947 instances of "abc".
>>> You can use LIMIT for this:
>>>
>>> DELETE FROM tbl_name WHERE col_name = "abc" LIMIT 3946;
>>>
>>>>
>>>> Paul DuBois wrote:
>>>>
>>>>> At 17:54 -0400 5/10/02, Augey Mikus wrote:
>>>>>
>>>>>> what i meant is deleting duplicate occurences of records of a 
>>>>>> certain field. ...sorry...
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> Ah.
>>>>>
>>>>> One thing you can do is add a unique index on that field with
>>>>> ALTER IGNORE TABLE tbl_name ADD UNIQUE (col_name)
>>>>> or
>>>>> ALTER IGNORE TABLE tbl_name ADD PRIMARY KEY (col_name)
>>>>>
>>>>> and MySQL will clobber duplicate records as it builds the index.
>>>>>
>>>>>>
>>>>>>
>>>>>> Paul DuBois wrote:
>>>>>>
>>>>>>> At 17:16 -0400 5/10/02, Augey Mikus wrote:
>>>>>>>
>>>>>>>> what is the simplest way to delete duplicate occurences of a 
>>>>>>>> specific field in mysql?
>>>>>>>>
>>>>>>>> thanks,
>>>>>>>>
>>>>>>>> augey
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> Your question is a bit ambiguous.  You could do this by using ALTER
>>>>>>> TABLE to remove the column itself from the table, for example, but
>>>>>>> I'm guessing maybe that's not what you mean.
>>>>>>
>
>




---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to