I'm wondering if such thing is possible with SQL only. What I'm trying to achieve here is the following:
An SQL table with the following column:
------------
| DURATION |
|----------|
| 5 |
| 14 |
| 3 |
| 25 |
| . |
| . |
| . |
I want to select all possible set of rows satisfying the sum of DURATION from each row being lesser than or greater than a given value. For example if the value is 20 then the result of lesser than 20 should contain 3 sets of rows
14 + 5
5 + 3
14 + 3