Is it possible to calculate cummulative frequency without the use of a cursor???
Consider the following test table:
CREATE TABLE TEST_SUM
(ID NUMBER primary key not null,
DEPT VARCHAR2(5),
VALUE NUMBER);
insert into test_sum values(1,'a',10);
insert into test_sum values(2,'a',60);
insert into test_sum values(3,'a',19);
insert into test_sum values(4,'a',13);
insert into test_sum values(5,'b',10);
insert into test_sum values(6,'b',15);
insert into test_sum values(7,'c',17);
insert into test_sum values(8,'c',9);
insert into test_sum values(9,'d',155);
insert into test_sum values(10,'e',15);
insert into test_sum values(11,'e',17);
select dept,sum(value)as val from test_sum
group by dept;
dept val
a 102
b 25
c 26
d 155
e 32
i want to calculate cummulative frequency of val. ie.
dept val cf
a 102 102
b 25 127
c 26 153
d 155 308
e 32 340
please help.