Code:
Connected to:
Oracle8i Enterprise Edition Release 8.1.7.4.1 - Production
With the Partitioning option
JServer Release 8.1.7.4.1 - Production
SQL> select * from table1;
C COL2
- ----------
A 10
B 15
C 20
D 5
E 30
F 15
G 25
7 rows selected.
SQL> SELECT col1, col2 FROM
2 (SELECT col1, col2,
3 SUM(col2) OVER (ORDER BY col1
4 RANGE UNBOUNDED PRECEDING) AS running_total
5 FROM table1)
6 WHERE running_total <= 45;
C COL2
- ----------
A 10
B 15
C 20
SQL>
Jurij Modic
ASCII a stupid question, get a stupid ANSI
24 hours in a day .... 24 beer in a case .... coincidence?
Bookmarks