List:General Discussion« Previous MessageNext Message »
From:Shen139 Date:September 25 2006 12:22pm
Subject:Re: Mysql Complex Query to clear Duplicate entries...
View as plain text  
Hi,

You can simply use the following query:

ALTER IGNORE TABLE <your_table> ADD UNIQUE INDEX(cli,type,status);

On 9/25/06, gerodim <gerodim@stripped> wrote:
>
>
> Hi there, I have this serious issue about a db i have to work with....
> Thing is there is a table called cpsorders....
> This table has  a structure like this...
> id,cli,type,schema,startdate,enddate,1date,2date,status,initiator
>
> 27425-210201021-XOR-3-0000-00-00 00:00:00-2005-03-09 00:00:00-2006-05-23
> 23:49:42-2005-03-09 00:00:00-TD4-TD
> 289267-210201021-XOR-3-0000-00-00 00:00:00-2005-03-09 00:00:00-2006-05-26
> 13:37:27-2005-03-09 00:00:00-TD4-TD
>
> there are a lot of duplicate entries there...
> What i need to do is to find out the entries that have the same
> cli,type,status (the rest are not so important) and delete all BUT ONE! I
> have no clue as to how i can delete all but one... Also the rest of the
> data
> may differ a little bit (datetimes for example) so i can't group them....
>
> Any ideas?
> --
> View this message in context:
>
> http://www.nabble.com/Mysql-Complex-Query-to-clear-Duplicate-entries...-tf2331150.html#a6485034
> Sent from the MySQL - General mailing list archive at Nabble.com.
>
>
> --
> MySQL General Mailing List
> For list archives: http://lists.mysql.com/mysql
> To unsubscribe:    http://lists.mysql.com/mysql?unsub=1
>
>


-- 
http://www.openwebspider.org
http://www.eviltime.com

-

" Time is what we want most, but what we use worst "

Thread
Mysql Complex Query to clear Duplicate entries...gerodim25 Sep
  • Re: Mysql Complex Query to clear Duplicate entries...Shen13925 Sep