Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Top n in sql
Hi
GHouck wrote:
> Örjan Lundberg wrote:
> >
> > select userid, count FROM (
> > select userid, count(*) as count from A
> > group by userid
> > order by 2 desc)
> > where ROWNUM <6;
> >
> The above solution does not appear to work in
> Oracle 7.3.3, apparently because of the ORDER BY
> in the sub-select. Is this restricted to 8.x?
Yes, the ORDER BY in a sub query is new with 8x
Rgds
Andrew
Received on Mon Jun 07 1999 - 00:34:01 CDT