Re: Top 20 records in a table ??
From: Valeri Sorokine <vsorokin_at_dd.ru>
Date: Mon, 10 Jan 2000 19:31:07 +0300
Message-ID: <387A094B.844333D4_at_dd.ru>
Date: Mon, 10 Jan 2000 19:31:07 +0300
Message-ID: <387A094B.844333D4_at_dd.ru>
[Quoted] [Quoted] 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.ruReceived on Mon Jan 10 2000 - 17:31:07 CET