Re: help how get the n top rows for any table?

2001-07-10 Thread Stas

If you're running  Oracle8i,
you can do this: 
SELECT *
FROM  (SELECT * FROM my_table ORDER BY col_name_1
DESC)
WHERE  ROWNUM  10;

Use this workaround with prior releases: 
SELECT *
FROM my_table a
WHERE 10 = (SELECT COUNT(DISTINCT maxcol)
  FROM my_table b
  WHERE b.maxcol = a.maxcol)
 ORDER BY maxcol DESC
;

Hope this helps!







--- Alexander Ordonez [EMAIL PROTECTED] wrote:
 Hi, gurus!!!
 
 A need know how get n top row for any table somebody
 can help me!!
 
 Thanks!!!
 
 @lex


   Lic. Alexander Ordóñez Arroyo 
   Caja Costarricense del Seguro Social  
   
   Soporte Técnico - División de Informática 

   Telefono: 295-2004, San José, Costa Rica  
  
   [EMAIL PROTECTED]
 


 UNIX is very user friendly, 
 It's just very particular about who it makes friends
 with.
 
 
 
 --
 Please see the official ORACLE-L FAQ:
 http://www.orafaq.com
 --
 Author: Alexander Ordonez
   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).


__
Do You Yahoo!?
Get personalized email addresses from Yahoo! Mail
http://personal.mail.yahoo.com/
-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: Stas
  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).



HOW TO SUBSTR INSTR THIS LIST

2001-06-27 Thread Stas

Hey all,

I've got this list of names.
It's not a very structured list.
So my question would be how do I get this names in a
select statement and break them up in columns: first
name (is the first name in list), last name (last
one),
middle name (everything in between first and last
names)

I know that this may be done by using SUBSTR AND
INSTR.

But how?

Would you please help?

Thanks a lot.

Here is a fragment of the list of names:

FULL_NAME
-
Caroline Bernard 
Sophia Cadi-Soussi ( Gailhardou )
Rudy Sicard  
Luis Haro-Garcma 
Philip Cohen 
Socrates Fragoulis   
Michael Munch
Hardip Kaur  
Robert Szasz 
Sebastien Schneider  
Telma Quiroga Lspez  
Stiphanie Frenkel
Samuel Tietse
Nicola Rose  
Oliver Cornely   
Philippe Saiag   
M.t. Hamed Mosavian  
R. Bruce Nicklas 
Valery Tsukerman 

FULL_NAME
-
Lidiya Smirenina 
Marie-Theres Hauser  
Jelel Ezzine 
Radhi Mhiri  
Franco Fenzi 
Hachne Djellout  
Beatrmz Quarterolo   
Bram van Dam 
Ted Gaten
Sergio Aravena   
Alberto Monroy-Garcia
Pedro Montecinos Becerra 
Michalis Vafopoulos  
Klaus E. Gempel  
Guijun Yan   
Stiphane Schaak  


__
Do You Yahoo!?
Get personalized email addresses from Yahoo! Mail
http://personal.mail.yahoo.com/
-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: Stas
  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).