Re: Top 20 records in a table ??
Date: Mon, 10 Jan 2000 18:59:15 +0100
Message-ID: <85d6cv$kpp$1_at_jaydee.iway.fr>
This solution causes a full table scan.
In my solution, you read only blocks containigs usefull information
Valeri Sorokine <vsorokin_at_dd.ru> a Êcrit dans le message :
387A094B.844333D4_at_dd.ru...
> You can try something like this also:
>
> select * from emp
> where pay*(-1) IN (select distinct e.pay*(-1) from emp e)
> and rownum <21;
>
> it uses background ordering of the DISTINCT clause...
>
> Hope that is interesting too... :-)
>
> agichen wrote:
> >
> > Hello,
> > How to select the highest 20 records from a table via sql*plus ??
> > For example,
> > emp table
> > ----------------
> > id number(5),
> > name varchar2(20),
> > pay number(8)
> >
> > how to select the highest 20 pay from emp ??
> >
> > Any idea ??
> > Rgds,
> > Agi
> >
>
> --
> Valeri Sorokine
> Oracle Certified Application Developer, Rel.2
> ProSoft, Russia, Moscow, Information Systems Division
> Phone: +7 (095) 234 0636 ; FAX: +7 (095) 234 0640
> E-mail: vsorokin_at_dd.ru ; http://www.dd.ru
Received on Mon Jan 10 2000 - 18:59:15 CET