MySQL to delete duplicate data, retaining only one data

When there is a large table MySQL duplicate data, but as long as a time data, the following can be used to quickly remove duplicate data sql, saving time, sql follows:

DELETE FROM `表名` WHERE id NOT IN (SELECT id from ( SELECT min(id) AS id FROM `表名` GROUP BY `分组字段`) temp);
Published 43 original articles · won praise 9 · views 10000 +

Guess you like

Origin blog.csdn.net/u013243938/article/details/104143225