# Write your MySQL query statement below
SELECT DISTINCT L1.Num AS ConsecutiveNums
FROM Logs AS L1
JOIN Logs AS L2 ON L1.Num = L2.Num
JOIN Logs AS L3 ON L2.Num = L3.Num
WHERE L1.id = L2.id + 1 and L2.id = L3.id + 1
#{"headers": {"Logs": ["Id", "Num"]}, "rows": {"Logs": [[1, 1], [2, 1], [3, 1], [4, 2], [5, 1], [6, 2], [7, 2]]}}
#{"headers": {"Logs": ["Id", "Num"]}, "rows": {"Logs": [[1, 1], [2, 1], [3, 1], [4, 2], [5, 1], [6, 1], [7, 1]]}}
#注意去重
# Write your MySQL query statement below
select distinct(Num) as ConsecutiveNums
from (
select Num,
@count := IF (@prev_num = Num, @count +1,1) as ct,
@prev_num := Num as n
from Logs, (select @count := 1, @prev_num := NULL) r
) as N
where ct >= 3