SQL——查找连续问题

描述
# Write your MySQL query statement below
select distinct a.Num as ConsecutiveNums
from Logs as a,Logs as b,Logs as c
where a.id = b.id-1 and b.id = c.id-1 and a.Num = b.Num and b.Num = c.Num;

你可能感兴趣的:(SQL——查找连续问题)