删除重复保留最大或最小
Screen Shot 2020-04-13 at 2.51.56 PM.pngSolution 1
DELETE P1
FROM Person AS P1, Person AS P2
WHERE P1.Email=P2.Email AND P1.Id>P2.Id
自连接,删除Email相同,但是ID大的记录
Solution 2
DELECT FROM PERSON
WHERE id not in (SELECT P1.id not in
((SELECT min(Id) as id
From Person
Group by Email) as P1)
网友评论