How would I query the range of a number column if the number ends somewhere then picks up again at a higher number?
If I had a column like:
Number
-------
1
2
3
4
5
11
12
13
How can I return a result like
Min | Max
----------
1 | 5
11 | 13
Another approach:
FIDDLE
Try this:
The where clause finds only min values for different ranges.
The sub-select finds lowest value with no value + 1 available.