首页 > 开发 > 综合 > 正文

196. Delete Duplicate Emails#1

2024-07-21 02:51:18
字体:
来源:转载
供稿:网友

Solution#1

# Write your MySQL query statement belowDELETE p1FROM Person p1, Person p2 WHERE p1.Email = p2.EmailAND p1.Id > p2.Id

Solution#2(更快)

# Write your MySQL query statement belowDELETE FROM Person WHERE Id NOT IN ( SELECT T.Id FROM ( SELECT MIN(Id) AS Id FROM Person GROUP BY Email ) T)
上一篇:Mongodb中FAQ整理

下一篇:sql 行转列

发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表