Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: Good Way to SELECT Max Occurence

Re: Good Way to SELECT Max Occurence

From: dd <dd_at_dd.com>
Date: Wed, 8 Jun 2005 20:20:58 +0800
Message-ID: <42a6e2ad_3@rain.i-cable.com>


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

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US