日期:2014-05-16  浏览次数:20675 次

mysql删除重复记录

我要删除的是url这个字段里面重复的记录,你可以根据自己的需求来替换。

DELETE FROM v9_spider  WHERE url IN (SELECT * FROM ( SELECT url FROM v9_spider GROUP BY url HAVING COUNT( * )>1) b  WHERE v9_spider.url=b.url) AND id NOT IN (SELECT * FROM ( SELECT MIN(id) AS id FROM v9_spider GROUP BY url) c WHERE v9_spider.id=c.id)
?

?