Why Run Time Error

  • 2

    Hi all,

    I'm new to MySQL. I don't quite understand why below query gives run time error?

    select L1.Num as ConsecutiveNums from Logs L1, Logs L2, Logs L3
    Where L1.Id=L2.Id-1 and L2.Id=L3.Id-1
    and L1.Num=L2.Num and L2.Num=L3.Num

    Thank you!

  • 0

    I,m also confuse this problem, the most star answer,if i copy his answer ,the judging is wrong,this makes me confuse

  • 0

    I guess the Leetcode changed the name of return value. So the right answer should be:

    select distinct(a.Num) AS ConsecutiveNums from Logs a, Logs b,Logs c where a.Id=b.Id+1 and a.Num=b.Num and b.Id=c.Id+1 and b.Num=c.Num

Log in to reply

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