我使用下面的SQL删除重复记录并仅保留min(id)记录
delete from admin_sync_user
where login_name in
(select login_name from
(select login_name from admin_sync_user group by login_name having count(login_name) > 1) as a)
and id not in
(select login_name from
(select min(id) from admin_sync_user group by login_name having count(login_name) > 1) as b)
但我的问题是:SQL只执行如下所示,并且不使用第二个条件。我正在使用MYSQL数据库。有谁知道上面的MySQL有什么问题以及如何修改它?
delete from admin_sync_user
where login_name in
(select login_name from
(select login_name from admin_sync_user group by login_name having count(login_name) > 1) as a)