[LeetCode] 180. Consecutive Numbers
2022. 6. 9. 23:05ㆍSQL
SELECT id AS ConsecutiveNums
FROM (
SELECT id,
num,
LEAD(num,1) OVER (ORDER BY id) AS two_num,
LEAD(num,2) OVER (ORDER BY id) AS three_num
FROM Logs) sub
WHERE num=two_num AND two_num=three_num
'SQL' 카테고리의 다른 글
[LeetCode] 1965. Employees With Missing Information (0) | 2022.06.16 |
---|---|
[LeetCode] 626. Exchange Seats (0) | 2022.06.09 |
[LeetCode] 1050. Actors and Directors Who Cooperated At Least Three Times (0) | 2022.06.09 |
[LeetCode] 197. Rising Temperature (0) | 2022.06.09 |
[HackerRank] Weather Observation Station 5 (0) | 2022.06.08 |