Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Good Way to SELECT Max Occurence
Akp wrote:
> Is this what you are looking for ? > =================================== > select * from > (select rownum rn,X.* > from(select count(*) ct,student_id > from student_enrollment > group by student_id > order by ct desc) X > )Y > where Y.rn=1; > ===================================
I think you can even omit one level of nesting.
Untested:
select X.*
from(select count(*) ct,student_id
from student_enrollment group by student_id order by ct desc) X
Kind regards
robert
> > > dd wrote: