[thelist] MySQL - Remove "almost" duplicates

Stephen Rider evolt_org at striderweb.com
Sun Aug 3 10:48:12 CDT 2008

On Aug 2, 2008, at 4:11 PM, Stephen Rider wrote:

>>> 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:
>> 	    (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. ;-)

I lied.  Jeremy's didn't work.  Adding a comma after "MyTable T2"  
helped, but it trips over the WHERE clause.

Kurt's version didn't work right off, but I'm working on it....


More information about the thelist mailing list