Check out example codes for "consecutive numbers sql". It will help you in understanding the concepts better.

Code Example 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;

Learn ReactJs, React Native from akashmittal.com