SELECT distinct 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
连续出现,即id是相连的,所以 l1.id = l2.id -1 and l2.id = l3.id - 1
保证了这个前提下,在加上条件 l1.num = l2.num and l2.num = l3.num即可保证三个数字是相同的
网友评论