查找重复数据
编写一个 SQL 查询,查找 Person 表中所有重复的电子邮箱。

Solution1
select Email
from Person
group by Email
having count(Email) > 1;
Solution2
自连接:不建议使用
Select distinct a.Email
From Person a join Person b
on a.Email=b.Email and a.Id<>b.Id
编写一个 SQL 查询,查找 Person 表中所有重复的电子邮箱。
Solution1
select Email
from Person
group by Email
having count(Email) > 1;
Solution2
自连接:不建议使用
Select distinct a.Email
From Person a join Person b
on a.Email=b.Email and a.Id<>b.Id
本文标题:2020-04-09-(03)
本文链接:https://www.haomeiwen.com/subject/qrqkmhtx.html
网友评论