How to group records of different values
Hi,
I have few records in table in this form:
CDE_FUND_CODE| |CDE_CLM_TYPE| |NUM_PCT| |NUM_SVC_DAYS| |
===========| |==========| |======| |==========| |
3R2A | | I | | 0.7215 | | 1 | |
3R2A | | I | | 0.2785 | | 1 | |
3R2A | | I | | 0.7215 | | 2 | |
3R2A | | I | | 0.2785 | | 2 | |
3R2A | | I | | 1.0000 | | 1 | |
3R2A | | I | | 0.2598 | | 1 | |
3R2A | | I | | 0.2401 | | 1 | |
3R2A | | I | | 0.5001 | | 1 | |
Now the notice the values of NUM_PCT
1) Sum of num_pct of first 2 records is 1.
2) Sum of num_pct of records 3rd and 4th is also 1.
3) num_pct of 5th record is 1.
4) Sum of num_pct of records 6th, 7th and 8th is 1.
So I want to write a query which gives me total 4 rows and output should look like this:-
CDE_FUND_CODE| |CDE_CLM_TYPE| |NUM_PCT| |NUM_SVC_DAYS| |
===========| |==========| |======| |==========| |
3R2A | | I | | 1.0000 | | 1 | |
3R2A | | I | | 1.0000 | | 2 | |
3R2A | | I | | 1.0000 | | 1 | |
3R2A | | I | | 1.0000 | | 1 | |
Please let me know if you have any idea about how to write query to get this output.
Thanks,
Rohit