关闭

182. Duplicate Emails

91人阅读 评论(0) 收藏 举报
分类:

Write a SQL query to find all duplicate emails in a table named Person.

+----+---------+
| Id | Email   |
+----+---------+
| 1  | a@b.com |
| 2  | c@d.com |
| 3  | a@b.com |
+----+---------+

For example, your query should return the following for the above table:

+---------+
| Email   |
+---------+
| a@b.com |
+---------+


SELECT DISTINCT a.Email AS Email
FROM Person a,Person b
WHERE a.Id!=b.Id AND a.Email=b.Email;

0
0

查看评论
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
    个人资料
    • 访问:31414次
    • 积分:1390
    • 等级:
    • 排名:千里之外
    • 原创:116篇
    • 转载:2篇
    • 译文:0篇
    • 评论:0条
    文章分类