From:Steve Adams
Date:12-Sep-2000 09:49
Subject:   Top-N with a twist

If you have 8.1.6, then you can use the RANK analytical function.

Ok, so we know how to use nested views to return a top-n report, right? Use order by in the nested view and use rownum in the outside view. Great.

What about to doing this for groups? I can't figure it out and it's making me nuts. (I'm sure some would argue that opinion. ) Example - I want the top ten selling employees for each department, or I want the top ten diagnoses in each clinic.

I've even pregrouped and pre-summed the employees or pre-counted the diagnoses so its a simple non-aggregate query I'm running. I just want to limit the results to 10 or 20 or 30 rows per region or clinic or department.