Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Top N rows based on aggregate function

415007Feb 16 2004 — edited Feb 17 2004
Hi,
I need to get a report in the following format

F_A F_B F_C Count_comb
100 200 300 5
100 201 300 5
100 202 301 4
100 203 111 3

Here, the Count_comb column gives the count of records which have the same (F_A + F_B + F_C) combination. The requirement is to show the Top-N combinations where the tied rows would have the same rank --that is if (100,200,300) combo and (100,201,300) combo have the same count, they should both be ranked the same.

I think this involves performing the rank() function on the count(), for which i was not able to write an SQL. Any help in this direction is appreciated.

Thanks,
<cfdoubt>

PS : Pardon the alignment--i hope you can make out what i mean
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Mar 16 2004
Added on Feb 16 2004
2 comments
135 views