Re: SQL Question

From: Eugenio <eugenio.spadafora_nospam_at_compaq.com>
Date: 2000/07/17
Message-ID: <8kv1li$c0n$1_at_mailint03.im.hou.compaq.com>#1/1


[Quoted] If id is a unique/PK column, this could help you.

select v.id, v.count
from (select rownum num, v1.*

      from (select id, count
            from table_name
            group by count, id) v1) v,
     (select count(*) maxnum from table_name)
where num > maxnum-10
--
Ciao

Eugenio
remove _nospam from reply address

Opinions are mine and do not necessarily reflect those of my company

=======================================================
?eljko JuriƦ wrote in message <8kus68$hnv$1_at_as102.tel.hr>...

>
>> select * from (
>> select * from table_name order by count desc )
>> where rownum <=10;
>>
>
>Sorry,
>
> Probably works with v.8.x by in my case doesn't help... (see version
>bellow) :-(
>
>
>=============================================================
>SQL*Plus: Release 3.3.2.0.2 - Production on Mon Jul 17 12:51:36 2000
>
>Copyright (c) Oracle Corporation 1979, 1994. All rights reserved.
>
>
>Connected to:
>Oracle7 Server Release 7.2.2.4.0 - Production Release
>PL/SQL Release 2.2.2.3.0 - Production
>
>
>===============================================================
>
>
>
>
Received on Mon Jul 17 2000 - 00:00:00 CEST

Original text of this message