Oracle - Group By with "steps"

Viewed 126

I have to following table:

|MY_VALUES|
|---------|
| 1       | 1' iteration
| 3       | 1' iteration   | 2' iteration
| 2       | 1' iteration   | 2' iteration   | 3' iteration
| 5       | 1' iteration   | 2' iteration   | 3' iteration
| 3       | 1' iteration   | 2' iteration   | 3' iteration
| 2       |                | 2' iteration   | 3' iteration
| 4       |                                 | 3' iteration

I need a query which output is the following:

MY_RESULTS
----------
14
15
16

The query is basically summing the first 5 rows for the first result, then it goes forward of one value and it sums the other 5 and so on...

Is there a way to do it with Oracle? I cannot find on the documentation anything for doing such work.

3 Answers
Related