题目

MySQL/196. Delete Duplicate Emails 删除重复的电子邮箱


MySQL/196. Delete Duplicate Emails 删除重复的电子邮箱

 

 

 

代码部分一(1433ms 50.12%)

# Write your MySQL query statement below
DELETE
    a
    FROM Person a,Person b
    WHERE a.Email=b.Email AND a.Id>b.Id;

 

 

代码部分二(933ms 90.55%)

# Write your MySQL query statement below
DELETE
FROM Person
WHERE 
     Id NOT IN(
     SELECT Id
     FROM (SELECT MIN(Id) AS Id FROM Person GROUP BY Email) AS p
     )

 

相关文章:

  • 2021-04-06
  • 2021-10-11
  • 2022-12-23
  • 2021-09-19
  • 2021-07-14
  • 2021-06-09
  • 2021-08-03
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-02-14
  • 2021-12-11
  • 2022-12-23
  • 2021-12-17
  • 2021-08-17
  • 2022-12-23
相关资源
相似解决方案