How do I parse a table of Dates (start / finish), Level(1,0), Type of Wave(Primary, Secondary, Tertiary values). I am trying to determine gap-time between each start date and all following records till EOF.

My CSV file has 15000-20000 records.  The start dates are ascending and the level is 1 and then 0 and then 1 ... etc

I am trying to take each record and then process down the subsequent records till I reach the end of the table.  Then I would select the next record and go down through the table and repeating this till all records have been processed.

How can I do this?  I am very new to Ninox and SQL so I am having trouble. Appreciate help.