Having a table with a column that represents a enumeration:
CASE 1
| CustomID | Values |
| '001'| ...|
| '002'| ...|
| '005'| ...|
| '006'| ...|
I need to get the max value in sequential order, in this case: '002'
| CustomID | Values |
| '028'| ...|
| '029'| ...|
| '031'| ...|
| '032'| ...|
Result expected: '029'
.
CASE 2 But if the data is like this:
| CustomID | Values |
| '001'| ...|
| '002'| ...|
| '003'| ...|
| '004'| ...|
I need to get '004'
.