I'm struggling to obtain the following results in a query
Here is my table
| Line_num | Line_typ | Cost |
|---|---|---|
| 1000 | 6 | 0 |
| 2000 | 7 | 5000 |
| 3000 | 7 | 3000 |
| 4000 | 7 | 2000 |
| 5000 | 6 | 0 |
| 6000 | 9 | 3000 |
| 7000 | 7 | 2000 |
| 8000 | 1 | 2000 |
What I want as result is this
| Line_num | Line_typ | Cost |
|---|---|---|
| 1000 | 6 | 10000 (0+5000+3000+2000) |
| 5000 | 6 | 5000 (0+3000+2000) |
| 8000 | 1 | 2000 |
Basically to display only rows with line_typ in (6,1) but sum the column costs of all other lines in between.
Thank you for your ideas and help !!
Ivan
