题目链接:
解析:
这道题比较简单,就是将表应用三次,直接使用WHERE
限定即可,值的注意的是需要使用DISTINCT
来进行去重。
题解:
# Write your MySQL query statement below
SELECT DISTINCT L1.Num AS ConsecutiveNums FROM Logs L1, Logs L2, Logs L3
WHERE L1.Id+1 = L2.Id AND L2.Id+1 = L3.Id AND L1.Num = L2.Num AND L2.Num = L3.Num;
网友评论