관련 문제: https://leetcode.com/problems/delete-duplicate-emails/
GROUP BY 후 함수를 적용한 결과를 WHERE 조건으로 사용하고 싶다면 중첩 SELECT 문을 작성한다.
1
2
3
4
5
6
7
8
9
DELETE FROM Person
WHERE id NOT IN (
SELECT min_id
FROM (
SELECT MIN(id) AS min_id
FROM Person
GROUP BY email
) M
);