delete from person where id not in
(select min(Id) from Person
group by Email) ;
It worked in Oracle
It is mysql's restriction,can't delete data just from a query that selected from the same table straight. Cover a select like below can solve it.Besides an alias is required.
delete from Person where Id not in (
select a.Id from
(select min(Id) as Id from Person group by Email) a
Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.