[thelist] MySQL - Remove "almost" duplicates
Mark Groen
evolt at markgroen.com
Sun Aug 3 12:42:33 CDT 2008
On Saturday 02 August 2008 07:28:05 Stephen Rider wrote:
> .........
> The table has more fields than that, so my version is more like:
>
> DELETE FROM T1
> 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
>
> ...but it doesn't work. I think the problem is in the second line.
>
> Any ideas how to make this work for MySQL?
A visit to dev.mysql.com to check syntax:
http://dev.mysql.com/doc/refman/5.0/en/delete.html
Looks like an extra FROM in there, is that the error line you are getting?
Further down the page, someone else deleting dupes with tables having primary
and foreign keys:
http://dev.mysql.com/doc/refman/5.0/en/delete.html#c5206
and just below that some other methods, hth.
--
cheers,
Mark
--
More information about the thelist
mailing list