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: <drona_at_my-dejanews.com>
Date: Tue, 05 Jan 1999 14:49:20 GMT
Message-ID: <76t8pf$5cp$1@nnrp1.dejanews.com>


How about using rownum
eg where rownum <= 10
Hope this helps.
Drona

In article <01be376a$c0707890$35140c0a_at_eagle>,   "Canberra" <ctcanb_at_mail.zip.com.au> wrote:
> Hi all.
>
> I hope someone can help with the following Oracle SQL problem.
>
> Consider the following table:
>
> SQL> desc keyword;
> Name Null? Type
> ------------------------------- -------- ----
> ID_OBJECT NOT NULL VARCHAR2(16)
> KEYWORD NOT NULL VARCHAR2(100)
>
> For each value of id_object there can one or more keyword.
>
> I need to work out a query that will return only the 10 most
> frequently occuring keywords.
> So far I have:
>
> select distinct (keyword), count(keyword)
> from keyword k
> group by keyword
> order by 2 desc;
>
> This shows the number of occurences of each keyword.
>
> How can I only show the 10 most frequently occuring keywords ?
> Is a PL/SQL procedure (or function) the answer ?
>
> Any help gratefully accepted.
>
> Thanks in advance,
>
> -Richard Barrott
> ctcanb_at_mail.dynamite.com.au
> u952297_at_student.canberra.edu.au
>

-----------== Posted via Deja News, The Discussion Network ==---------- http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own Received on Tue Jan 05 1999 - 08:49:20 CST

Original text of this message

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