Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Mailing Lists -> Oracle-L -> RE: top n or top n%

RE: top n or top n%

From: ??? <ljsf19_at_dreamx.net>
Date: Tue, 13 Feb 2001 16:40:42 -0800
Message-ID: <F001.002B33DF.20010213163526@fatcity.com>

try this.
select * from emp a
where 20 > (select count(*) from emp b

                    where  a.sal < b.sal);

-----Original Message-----
From: root_at_fatcity.com [mailto:root_at_fatcity.com]On Behalf Of Suhen Pather Sent: Wednesday, February 14, 2001 7:33 AM To: Multiple recipients of list ORACLE-L Subject: RE: top n or top n%

Leslie,

Try using a rownum.

select * from emp
where rownum<20
order by sal;

HTH
Suhen

Hi listers,

I remeber vaguely there is a way to select top n or top % rows of a select statement. But I cannot find it anywhere. Could somebody let me know? Thank you.

Leslie



Do You Yahoo!?
Get personalized email addresses from Yahoo! Mail - only $35 a year! http://personal.mail.yahoo.com/
--

Please see the official ORACLE-L FAQ: http://www.orafaq.com
--

Author: Leslie Lu
  INET: leslie_y_lu_at_yahoo.com
Fat City Network Services    -- (858) 538-5051  FAX: (858) 538-5051
San Diego, California        -- Public Internet access / Mailing Lists
--------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing).
--

Please see the official ORACLE-L FAQ: http://www.orafaq.com
--

Author: Suhen Pather
  INET: Suhen.Pather_at_strandbags.com.au
Fat City Network Services    -- (858) 538-5051  FAX: (858) 538-5051
San Diego, California        -- Public Internet access / Mailing Lists
--------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing).zǞ&die;}ND
+irhDNX_]wB܍z(Dz9Nuw9&'&+&bpz޵z?1&die;x lND0Dʋ_~&&die;x%lzwZCYƠz Fj"'(z-xE + ;)zYb
.+-jwb^,j86"nu楊w{ZxCRP Received on Tue Feb 13 2001 - 18:40:42 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US