Duplicate Emails

  • 0

    Click here to see the full article post

  • 0

    Write your MySQL query statement below

    select distinct p1.Email as Email
    from Person p1, Person p2
    where p1.Email = p2.Email
    and p1.Id <> p2.Id

  • 0

    SELECT Email FROM Person
    GROUP BY Email

    This works, but can I understand that * as Email only? If yes, is it because it's the only element in SELECT, or is it because it's the only element in GROUP BY?

  • 0

    SELECT email
    FROM Person
    GROUP BY email
    HAVING COUNT(email) > 1

  • 0

    select Email from Person
    group by Email
    having count(*) >1;

Log in to reply

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