编写一个 SQL 查询,查找所有至少连续出现三次的数字

LetCode力扣的数据库练习题。

题目描述:

题解:
 

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
发布了102 篇原创文章 · 获赞 49 · 访问量 6万+

猜你喜欢

转载自blog.csdn.net/SoWhatWorld/article/details/104859986