时间:2021-07-01 10:21:17 帮助过:22人阅读
# Write your MySQL query statement below SELECT Email FROM Person GROUP BY Email HAVING COUNT(*) > 1
方法1: join再删掉不需要的。
DELETE p2 FROM Person p1 JOIN Person p2 ON p2.Email = p1.Email WHERE p2.Id > p1.Id;
方法2: 不用join, 用where:
DELETE p2 FROM Person p1, Person p2 WHERE p1.Email = p2.Email AND p2.Id > p1.Id;
Leetcode 196. Delete duplicate Emails. (Database)
标签:rom mysq john cat tab trie prim ble tco