The threshold of value is 10. If the value greater than 10 then the next row will start as a new group. The example is listed below. For first two rows' value are all smaller than 10, so they belong to group 1, the third row value is 15 which is larger than 10, so the next row(forth row) will start as a new group(group2). How should I develop the code in Oracle to implement this grouping method?
Value | Group |
---|---|
5 | group1 |
2 | group1 |
15 | group1 |
3 | group2 |
13 | group2 |
40 | group3 |
4 | group4 |
5 | group4 |
20 | group4 |
2 | group5 |