Mysql删除重复记录,只保留一条记录
作者:xlnxin发布时间:2024-06-19分类:其他教程浏览:341
导读:删除表中多余的重复记录,重复记录是根据单个字段(peopleId)来判断,只留有rowid最小的记录delete from php_user wher...
删除表中多余的重复记录,重复记录是根据单个字段(peopleId)来判断,只留有rowid最小的记录
delete from php_user where username in (select username from ( select username from php_user group by username having count(username)>1) a) and id not in ( select min(id) from (select min(id) as id from php_user group by username having count(username)>1 ) b)
标签:mysql
- 其他教程排行
- 最近发表