Duplicate Emails

2018-06-01 17:08:35 浏览数 (1)

原题Duplicate Emails

group by后,记录id 最大值最小值,两个最值不一样就是重复邮箱

代码语言:javascript复制
select email from ((select min(id) as minid,max(id) as maxid, email 
from person group by email) as newPerson) where minid != maxid

利用having count函数

代码语言:javascript复制
#select Email from Person group by Email having count(*)>1;
#select sum(id/id) email from person group by email

# 利用count(*)计数
select email from person group by email having count(*)>1

0 人点赞