原题Duplicate Emails
代码语言:javascript复制group by后,记录id 最大值最小值,两个最值不一样就是重复邮箱
select email from ((select min(id) as minid,max(id) as maxid, email
from person group by email) as newPerson) where minid != maxid
代码语言:javascript复制利用having count函数
#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