LeetCode--182.寻找重复的电子邮箱
程序员文章站
2022-07-08 14:24:05
...
建表
Create table If Not Exists Person (Id int,Email varchar(255));
Truncate table Person;
insert into Person (Id, Email) values ('1','aaa@qq.com');
insert into Person (Id, Email) values ('2','aaa@qq.com');
insert into Person (Id, Email) values ('3','aaa@qq.com');
根据邮箱分组统计,个数大于1
select Email, count(1)
from person
GROUP BY Email
HAVING count(1) > 1