LeetCode.180. 连续出现的数字
分析:

自连接两次,每次差值为1,检索第一个表即可。

代码:

select distinct l1.Num as ConsecutiveNums
from Logs l1 left join Logs l2 on l1.Id=l2.Id-1 left join Logs l3 on l2.Id=l3.Id-1
where l1.Num=L2.Num and l2.Num=l3.Num;

相关文章:

  • 2021-09-30
  • 2022-12-23
  • 2021-09-26
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-07-20
  • 2022-12-23
猜你喜欢
  • 2021-11-23
  • 2022-12-23
  • 2021-09-01
  • 2021-11-11
  • 2022-12-23
  • 2021-07-01
  • 2021-04-18
相关资源
相似解决方案