PHP/Mysql中如何删除所有重复记录
可能的重复:
如何删除mysql数据库中的重复记录?
有重复mysql 表中的行。 如何找到重复的行并删除它们。
Possible Duplicate:
How to delete duplicate records in mysql database?
there are duplicate rows in the mysql table.
how find the duplicate rows and delete them.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我的首选解决方案:
如何删除mysql数据库中的重复记录?
将来,使用唯一/主键来确保这种情况不会再次发生。
My preferred solution:
How to delete duplicate records in mysql database?
In the future, use unique/primary keys to make sure this doesn't happen again.
定义要用于确定重复的列并在其上添加唯一索引。
这样做的优点是可以防止将来重复。
Define the columns that you want to use to determine duplication and add a unique index on them.
This has the advantage of preventing future duplicates.
DELETE * ,count(*)as n FROM
addgroup by id HAVING n>1
。它将删除所有重复记录
DELETE * ,count(*)as n FROM
addgroup by id HAVING n>1
.It will delete all duplicate records