[leetcode]182. Duplicate Emails
Analysis
心情复杂~—— [ummmmmm~]
Write a SQL query to find all duplicate emails in a table named Person
SQL语句的使用,找出表格中重复的邮箱地址。
Implement
方法一
# Write your MySQL query statement below
select distinct p1.Email from Person p1, Person p2
where p1.Id<>p2.Id and p1.Email = p2.Email;
方法二(group by)
# Write your MySQL query statement below
select distinct p1.Email from Person p1
group by p1.Email having count(p1.Email)>1;