[thelist] MySQL - Remove "almost" duplicates

Stephen Rider evolt_org at striderweb.com
Sat Aug 2 16:11:45 CDT 2008


>> I'm trying to remove records from a table that are identical except
>> for the "time" field.

On Aug 2, 2008, at 3:05 PM, Jeremy Weiss wrote:

> I haven't a clue if this is right, but if it were me, I'd try  
> something like this:
>
> 	    DELETE FROM T1 WHERE
> 	    (SELECT * FROM MyTable T1, MyTable T2
> 	    WHERE T1.dupField = T2.dupField
> 	    AND T1.dupField2 = T2.dupField2
> 	    AND T1.dupField3 = T2.dupField3
> 	    AND T1.uniqueField > T2.uniqueField)
>
> **use at your own risk. may delete every record in the table,
> burn your toast, and wreck your car. I assume no responsibility**

Jeremy -- Worked perfectly, thanks!

Kurt -- I went with Jeremy's because, frankly, I understand it. ;-)

Stephen

-- 
Stephen Rider
<http://striderweb.com/>



More information about the thelist mailing list