ice rabbit programming

[LeetCode] Delete Duplicate Emails 본문

PS/LeetCode

[LeetCode] Delete Duplicate Emails

판교토끼 2020. 5. 3. 13:13

https://leetcode.com/problems/delete-duplicate-emails/

 

Delete Duplicate Emails - LeetCode

Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview.

leetcode.com

중복 email을 제거하는 문제이다. 처음에는 SELECT에서 중복을 없애고 조회하는 쿼리를 짰었는데, 이상해서 다시 살펴보니 DELETE 쿼리를 날려야 하는 문제였다...

DELETE b
FROM Person a, Person b
WHERE a.Email = b.Email
AND a.Id < b.Id;