Top N rows based on aggregate function
415007Feb 16 2004 — edited Feb 17 2004Hi,
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