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

Home -> Community -> Usenet -> c.d.o.server -> Re: Tricky SQL question

Re: Tricky SQL question

From: CT Canberra <ctcanb_at_dynamite.com.au>
Date: 4 Jan 1999 21:41:16 GMT
Message-ID: <01be382b$7efa3ab0$35140c0a@eagle>

Vagelis Rados <Vrados_at_Singular.gr> wrote in article <36907d77.5170628_at_news-ath.forthnet.gr>...
> change the sql statement to:
> select distinct (keyword), count(keyword)
> from keyword k
> where rownum < 11
> group by keyword
> order by 2 desc;
> The Usage of the pseudo column ROWNUM eliminates the output
> of the wuery to 10 rows.

Thanks, nice try but it won't work. :-)

ROWNUM is set before the rows are sorted by the ORDER BY clause. - It's the order the rows are retrieved - so ROWNUM's 1 to 10 will have no relation to my 'top 10'.

Thanks anyway!

-Richard B.
PS I tried this one a couple of days ago: :-( Received on Mon Jan 04 1999 - 15:41:16 CST

Original text of this message

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