Skip to content

Commit 31a782f

Browse files
committed
update delete duplicate mmails
1 parent 5cf1d87 commit 31a782f

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

database/06-Delete-Duplicate-Emails.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,9 @@ For example, after running your query, the above Person table should have the fo
1717
|2|bob@example.com|
1818

1919
**解法**
20+
2021
错误示范
22+
2123
```mysql
2224
DELETE FROM Person WHERE Id NOT IN (
2325
SELECT Id FROM Person GROUP BY Email ORDER BY Id ASC
@@ -26,6 +28,7 @@ DELETE FROM Person WHERE Id NOT IN (
2628
现在才知道这样会引起语法错误,而且GROUP BY 和 ORDER BY 同时用,上面的例子ORDER BY其实没有效果。
2729

2830
有其他提交也是类似的思路,正确的应该使用MIN函数:
31+
2932
```mysql
3033
DELETE FROM Person
3134
WHERE Id NOT IN (

0 commit comments

Comments
 (0)