consecutive sql code example
Example: consecutive numbers sql
SELECT DISTINCT l1.Num AS ConsecutiveNums FROMLogs AS l1, Logs AS l2, Logs AS l3WHERE l1.Num = l2.Num AND l2.Num = l3.Num ANDl1.Id = l2.Id - 1 AND l2.Id = l3.Id - 1;
SELECT DISTINCT l1.Num AS ConsecutiveNums FROMLogs AS l1, Logs AS l2, Logs AS l3WHERE l1.Num = l2.Num AND l2.Num = l3.Num ANDl1.Id = l2.Id - 1 AND l2.Id = l3.Id - 1;