Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Mailing Lists -> Oracle-L -> Top-N with a twist
All,
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.
(I think it's time to go back into biology and think about that pre-med degree I gave up. It's been that kind of day anyway.)
Any ideas? Pretty please!!?
Thanks,
Yosi
![]() |
![]() |