What's wrong with my solution? (without group by)


  • 0
    D

    Write your MySQL query statement below

    SELECT Email FROM Person
    HAVING (COUNT(Email)>1);

    Without GROUP BY Email, I alway got wrong answer. What is GROUP BY, why it matters here?


  • 0
    M

    Having clause should always be used with Group by as far as I know.


  • 0
    L

    The HAVING clause should always come with the GROUP BY clause, to make the semantics clear. Otherwise, the SQL interpreter would not know which attribute to aggregate.


Log in to reply
 

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