当前位置:Gxlcms > 数据库问题 > 题目5:MySQL----------Consecutive Numbers

题目5:MySQL----------Consecutive Numbers

时间:2021-07-01 10:21:17 帮助过:35人阅读

# Write your MySQL query statement below
select distinct Num from (
    select
        Num,
        case
            when @prevNum = Num then @count := @count + 1
            when (@prevNum := Num) is not null then @count := 1
        end n
    from Logs, (select @prevNum := NULL) r
    order by Id
) a where n >= 3



题目5:MySQL----------Consecutive Numbers

标签:mysql   database   consecutive numbers   

人气教程排行