why my answer is wrong?


  • 0
    C

    delete t1 from Person t1 left join
    (select Id,Email from Person group by Email having count(Email)>=2) t2 on t1.Email=t2.Email where t1.Id>t2.Id;
    why is wrong ?


  • 0
    W

    delete t1 from Person t1 left join
    (select min(Id) Id,Email from Person group by Email having count(Email)>=2) t2 on t1.Email=t2.Email where t1.Id>t2.Id;

    use min(id) instead.


Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.