Why this does not work?


  • 0
    X

    Why this :"Delete from Person where Id not in (select Id from (min(Id) as Id from Person group by Email) a);"

    works.

    But this:" Delete from Person where Id not in (select min(a.Id) from Person a group by a.Email);"
    can not work.


  • 1
    S

    In Mysql you can't modify the same table which you use in the SELECT part.


  • 0
    X

    Thank for your answer. But the Person I put 'a' after it as another table. This can not work, either? It has to be another table which create by some constraint statements?


Log in to reply
 

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