leetcode 196. Delete Duplicate Emails

 

# 慢,内连接
delete
p1 from Person p1, Person p2 where p1.Email=p2.Email and p1.Id>p2.Id

 

delete from Person
where Id not in (
    select Id from (
    select min(Id) as Id from Person group by Email) p);

 

posted on 2018-01-31 10:45  willaty  阅读(112)  评论(0编辑  收藏  举报

导航