leetcode 182 查找重复的电子邮箱

查找重复的电子邮箱

 对于mysql来说 inner join 就是在做笛卡尔积

 

select email as Email from Person group by email having count(email) > 1

 

select email as Email from (
    select email ,count(email) as c from Person group by email
) r where r.c > 1

 

select distinct p1.email as Email from Person p1
inner join Person p2
on p1.email = p2.email
and p1.id != p2.id

 

==

posted @ 2023-04-11 15:44  Carl_ZhangJH  阅读(8)  评论(0)    收藏  举报