Re: Top 20 records in a table ??

From: Valeri Sorokine <vsorokin_at_dd.ru>
Date: Tue, 11 Jan 2000 11:13:07 +0300
Message-ID: <387AE613.C1EC1D4A_at_dd.ru>


Hi Adriano,

Thank you for your question.

It's just for descending order of the result set: -1 * value

Hope that helps.

P.S. By the way, did you find which solution is the fastest?

     Please tell us this useful info...

Adriano Prado wrote:
>
> Hi Valeri, what does the "where col*(-1)" do??? (where could I find
> more info about it?)
>
> Thanks,
> Adriano.
> ______________________________________
> In article <387A094B.844333D4_at_dd.ru>,
> Valeri Sorokine <vsorokin_at_dd.ru> wrote:
> > 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

<skip>

-- 
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 Tue Jan 11 2000 - 09:13:07 CET

Original text of this message