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: Top n in sql

Re: Top n in sql

From: Andrew Babb <andrewb_at_mail.com>
Date: Mon, 07 Jun 1999 13:34:01 +0800
Message-ID: <375B59C9.793109EF@mail.com>


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

Original text of this message

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