try this.
select * from emp a
where 20 > (select count(*) from emp b
where a.sal < b.sal);
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]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: [EMAIL PROTECTED]
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: [EMAIL PROTECTED] (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: [EMAIL PROTECTED]
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: [EMAIL PROTECTED] (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Ç�¶¨}ø��©ND �±@Bm§ÿðÃ
+iöªr��ºØh¬�DNXì_]æ¦Æw«B�Ü�zÜ(®D�®ø�zÏ9ó�üçNuüçÎwó�9Õ&§' &¥�ú+�&�¹¹bp�íz¹Þµ§zË?1¨¥�x�ËlN�D0åDÊ�«±é_~º&¶¬�¨¥�x%�ËlzwZ�C�Y�²Æ zÚ�ËFº»�j×"·'(�z-xEÀ
+ ;)zYb�
.+-êîjwb�Ø^�ë,j�86"�Énuæ¥�w�¢{Z�x§�CRP� "Ä.�í�éÚ�ê�¨¥�x%�Ër¢ì�ÛhmêÞ��Þuúè��.�¬��Ê,zwm�áÄ,÷(�f§uú+¢Ø^®)ߢ¹�¶*'�)²æìr¸��x