반응형
서브쿼리
DELETE
FROM
person
WHERE
id NOT IN (
SELECT
id
FROM (
SELECT
email,
MIN(id) as id
FROM
person
GROUP BY 1
) temp
)
조인
DELETE
p1
FROM
person p1
INNER JOIN
person p2 on p1.email = p2.email
WHERE
p1.id > p2.id
반응형
'Database' 카테고리의 다른 글
HackerRank The Report [ MySQL ] (0) | 2021.11.24 |
---|---|
LeetCode Department Highest Salary [ MySQL ] (0) | 2021.11.16 |
LeetCode SQL Swap Salary [ MySQL ] (0) | 2021.11.01 |
[Mysql] Group By와 Having (0) | 2020.05.24 |
Mysql 한글 입력이 안될 때 해결법 (0) | 2020.04.10 |