题目:180. 连续出现的数字 - 力扣(LeetCode)
解决:
SELECT DISTINCT num as 'ConsecutiveNums'
FROM Logs l1
WHERE EXISTS (
SELECT *
FROM Logs l2
WHERE l2.num = l1.num
AND EXISTS (
SELECT *
FROM Logs l3
WHERE l3.num = l1.num
AND l3.id = l2.id + 1
AND EXISTS (
SELECT *
FROM Logs l4
WHERE l4.num = l1.num
AND l4.id = l3.id + 1
)
)
);