Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.tools -> Re: how to get top 10 of query
Michael J. Ort wrote:
>
> Try this (NOTE: I'm on 8.1.5, and I can't remember if prior versions
> can do the ORDER BY in an inline view):
>
> SELECT
> count
> , fatxt
> FROM
> (
> SELECT
> COUNT(fatxt) count
> , fatxt
> FROM
> vfufehl
> WHERE sprache = 'D'
> GROUP BY
> fatxt
> ORDER BY
> COUNT(fatxt) DESC
> )
> WHERE ROWNUM < 11;
>
> HTH,
> Michael J. Ort
>
> In article <38F5B7FF.A7B84294_at_bmw.de>,
> Juergen Leeb <juergen.leeb_at_bmw.de> wrote:
> > Dies ist eine mehrteilige Nachricht im MIME-Format.
> > --------------AB5DABDBB3C300C3D929FDED
> > Content-Type: text/plain; charset=iso-8859-1
> > Content-Transfer-Encoding: quoted-printable
> >
> > thank you, but this doesn' t work because i want to get the highest
> > value of count till the 10 highest.
> > your suggestion only give my the first 10 row of the orginal table!
> >
> > Stefan Martin schrieb:
> > > =
> > > Hey J=FCrgen:
> > > =
> > > versuch es mal damit
> > > =
> > > select *
> > > from <table>
> > > where rownum between 1 and 10
> > > =
> > > Juergen Leeb schrieb in Nachricht <38F5AF74.E149CF93_at_bmw.de>...
> > > >i have to query only the first 10 datasets from following query:
> > > >
> > > >select count(FATXT),FATXT from vfufehl where SPRACHE =3D 'D'
group by=
> > > >FATXT order by count(FATXT) desc
> > > >
> > > >which command do i need?
> > > >
> > > >thank you for your help!!!!!!
> > --------------AB5DABDBB3C300C3D929FDED
> > Content-Type: text/x-vcard; charset=us-ascii;
> > name="juergen.leeb.vcf"
> > Content-Transfer-Encoding: 7bit
> > Content-Description: Visitenkarte für Juergen Leeb
> > Content-Disposition: attachment;
> > filename="juergen.leeb.vcf"
> >
> > begin:vcard
> > n:Leeb;Juergen
> > x-mozilla-html:TRUE
> > adr:;;;;;;
> > version:2.1
> > email;internet:juergen.leeb_at_bmw.de
> > fn:Juergen Leeb
> > end:vcard
> >
> > --------------AB5DABDBB3C300C3D929FDED--
> >
> >
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.
You can't do it before 8i (bummer eh?). In 8.1.6, there is now the RANK function which claims to be faster..
HTH
-- =========================================== Connor McDonald http://www.oracledba.co.uk We are born naked, wet and hungry...then things get worseReceived on Fri Apr 14 2000 - 00:00:00 CDT