@Zlu911Sap Only if it was not consecutive.
Got it, I forget to consider the consecutive condition.
I redo the work on the sql server by creating the tables there. I am not sure if the following query looks good or not, please advice.
select distinct logs.id,logs.num from logs, logs as logs1, logs as logs2
where logs.id=logs1.id +1