less than 1 minute read

Problem

problem

Query

Note:

  • because WHERE cannot be used with the GROUP BY, that’s why we have HAVING clause.
SELECT
    email
FROM
    Person
GROUP BY email
HAVING COUNT(email) > 1

Editorial Solution

Approach 1: Using GROUP BY and Subquery

select Email from
(
  select Email, count(Email) as num
  from Person
  group by Email
) as statistic
where num > 1
;

Tags:

Updated: