出错的代码(在oracle可执行成功):
delete from people where name in
(
select name from people GROUP BY name HAVING count(1)>1
) and id not in (select min(id) from people GROUP BY name having count(1)>1 )
修改后的代码:
delete from people where name in (
select a.name from
(
select name from people GROUP BY name HAVING count(1)>1
)a) and id not in(
SELECT b.id from
(select min(id) id from people GROUP BY name having count(1)>1) b)