why my code is not working online


  • 0
    T

    why my code is not working online, but it works locally.

    set @c = 1;
    set @preNum = NULL;

    SELECT distinct f.Num AS 'ConsecutiveNums' FROM
    (SELECT
    Id, Num,
    CASE
    WHEN @preNum=Num THEN @c:=@c+1
    ELSE @c:=1
    END AS n,
    @preNum:=Num
    FROM Logs) AS f where f.n>=3;

    it has an error message as
    "Last executed input:
    {"headers": {"Logs": ["Id"
    "Num"]}
    "rows": {"Logs": []}}"


Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.