Why must use AS to refer?


  • 0
    C

    This is the way I did for this question.
    '''
    DELETE FROM Person
    WHERE Id IN
    (SELECT Id FROM
    (SELECT a.Id FROM Person AS a
    JOIN Person AS b
    ON a.Email=b.Email AND a.Id>b.Id) AS p);'''

    However, if I change the code to this:

    '''
    DELETE FROM Person
    WHERE Id IN
    (SELECT a.Id FROM Person AS a
    JOIN Person AS b
    ON a.Email=b.Email AND a.Id>b.Id) ;'''
    It doesn't work.
    Could anyone tell me why I have to use another SELECT to refer my subquery AS p?


Log in to reply
 

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