0

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
Lu Liu
  • 1
  • 1
    https://stackoverflow.com/a/2483877/700 – Brian Jul 06 '21 at 02:29
  • 1
    To identify "first" rows you need to have some fields, that define ordering, but they are absent in your structure. SQL table is an unordered set of rows. – astentx Jul 06 '21 at 07:14

0 Answers0