Difficult grouped report from database
<pre><code>ID  |  Start of range | End of range
------------------------------------
ID1 |  Ok-000001      | Ok-000009
ID1 |  Ok-000010      | Ok-000014
ID1 |  Ok-000015      |
ID1 |  Ok-000016      | Ok-000018
ID1 |  Ok-000037      | Ok-000042
ID2 |  Ok-000043      | Ok-000045
ID2 |  Ok-000046      | Ok-000052
</code></pre>

<p>From the sample database records above, I would like to produce a report with the following format:</p>

<pre><code>ID1 Ok-000001 - Ok-000018, Ok-000037 - Ok-000042
ID2 Ok-000043 - Ok-000052
</code></pre>

<p>In the actual database, there are 55,640 records with 1,559 unique IDs.</p>

<p>I'll take any and all guidance.  I know that I need to group by ID.  I know that I should ignore the "Ok-" and just work with the numeric values.  I don't know how to look at the "Start of range" in the <em>next</em> record to see if it's a continuation of the "End of range" in the current record.</p>