删除表中多余的重复记录,重复记录是根据单个字段(id)来判断,只留有rowid最小的记录

//删除用户根据用户名,并且不包括最小ID
delete from users where username in(
//根据用户名称排序,大于1
    select username from users 
    groupby username having count(username)>1
 
)and Id not in(
--根据用户名排序,获取最小ID
    select min(Id) from users 
    groupby username having count(username)>1

相关文章:

  • 2021-06-15
  • 2021-07-14
  • 2022-03-05
  • 2022-12-23
  • 2021-09-03
  • 2022-02-04
  • 2021-08-18
猜你喜欢
  • 2022-01-27
  • 2022-01-17
  • 2021-08-12
  • 2022-12-23
  • 2022-02-02
  • 2022-12-23
相关资源
相似解决方案