答案
select Num as ConsecutiveNums from (select T.Num, max(T.Count) as Count from (select Num, (case when @pre <> (@pre := Num) then @i := 1 else @i := @i + 1 end) as Count from Logs, (select @i:=0, @pre:=0) init) as T group by Num) as L where L.Count >= 3;
如果不懂,可以参考下下面两个博客讲解再来一步步写这道题就ok了,加油,相信自己!
https://blog.csdn.net/changrj6/article/details/102508658
https://blog.csdn.net/changrj6/article/details/102483737