删除表中多余的重复记录,重复记录是根据单个字段(id)来判断,只留有rowid最小的记录
//删除用户 根据用户名,并且不包括最小ID
delete from users where username in (
--根据用户名称排序,大于1
select username from users group by username having count(username) > 1
) and Id not in (
--根据用户名排序,获取最小ID
select min(Id) from users group by username having count(username) > 1
);
本是小题大做,这两天自己的站被恶意刷了,所以手贱....
---------------------
作者:YDTD
来源:CSDN
原文:https://blog.csdn.net/qq_35997094/article/details/82696223
版权声明:本文为博主原创文章,转载请附上博文链接!
最新评论