Selfjoin
LeetCode Consecutive Numbers [ MySQL ]
Consecutive Numbers - 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 연속적인 id를 확인하기 위해 아이디 + 1과 SELF JOIN을 두 번 하였습니다. 이후에 중복 제거를 통해 답을 출력했습니다. SELECT DISTINCT l1.num AS ConsecutiveNums FROM Logs l1 INNER JOIN Logs l2 ON l1.num = l2.num AND l1.id + 1 = l2.id INNER JOIN Logs l3 ON l2..