Using Teradata SQL, but it seems doesn't work.
FROM Logs M
INNER JOIN (SELECT B.*
FROM Logs A
INNER JOIN Logs B ON A.Id = B.Id - 1
WHERE A.Num = B.Num) N ON N.Id = M.Id - 1
WHERE M.Num = N.Num;
Can anyone tell me is this correct?
Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.