Logs
table three times, creating aliases l1
, l2
, and l3
.l1
with l2
where l2.id
is l1.id + 1
.l2
with l3
where l3.id
is l2.id + 1
.l1.num
, l2.num
, and l3.num
are the same.DISTINCT
keyword to select unique num
values that meet the above conditions.ConsecutiveNums
.erDiagram Logs { int id PK varchar num }