mysql删除重复数据
Posted 荣耀的背后
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了mysql删除重复数据相关的知识,希望对你有一定的参考价值。
DELETE FROM table WHERE id IN ( SELECT src.id FROM ( SELECT t1.id FROM table t1 WHERE ( t1.col1, t1.col2, t1.col3, t1.col4, t1.col5 ) IN ( SELECT col1, col2, col3, col4, col5 FROM table GROUP BY col1, col2, col3, col4, col5 HAVING count(*) > 1 ) AND t1.id NOT IN ( SELECT MAX(id) FROM table GROUP BY col1, col2, col3, col4, col5 HAVING count(*) > 1 ) ) src );
以上是关于mysql删除重复数据的主要内容,如果未能解决你的问题,请参考以下文章