Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Good Way to SELECT Max Occurence
Thx
"Dmitry E. Loginov" <lde_at_mpsb.ru> ¦b¶l¥ó news:d86m7r$1cbh$1_at_news.caravan.ru
¤¤¼¶¼g...
>
> select student_ID, CNT from (
>
> select student_ID, count(*) CNT
>
> , RANK() OVER ( ORDER BY count(*) DESC) N from student_enrollment
>
> group by student_ID
>
> ) where N=1
>
>
>
The top N analysis approach returns just 1 student - even if there are > 1
students with max enrollment. I am looking for solutions which returns ALL
the max rows. It seems that the better solution must use analytic functions
(which I have no knowledge of)!
Received on Wed Jun 08 2005 - 07:20:58 CDT