RE: How To Pull Second Row from 100 ROWS

2003-10-21 Thread Grant Allen


--
The contents of this post are my opinions only
  If swallowed seek medical advice 

> -Original Message-
> From: Muqthar Ahmed [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, 22 October 2003 06:44
> To: Multiple recipients of list ORACLE-L
> Subject: How To Pull Second Row from 100 ROWS
> 
> 
> Hi,
> 
> Is there a way to pull ONLY 2nd row from the selected rows.
> 
> Thanks
> Muqthar Ahmed
> DBA

Others have shown the proprietary Oracle way.  Assuming your instance has the 
necessary plumbing, you can use the OLAP approach ... which also happens to transport 
to other RDBMS.

SELECT a.blah, a.blahblah ...
FROM
  ( SELECT
  ROW_NUMBER() OVER (blah) AS row_number, blah, blahblah
FROM 
[where ...]
  ) a
WHERE a.row_number =2;

Enjoy!

Ciao
Fuzzy
:-)
-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.net
-- 
Author: Grant Allen
  INET: [EMAIL PROTECTED]

Fat City Network Services-- 858-538-5051 http://www.fatcity.com
San Diego, California-- Mailing list and web hosting services
-
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).


RE: How To Pull Second Row from 100 ROWS

2003-10-21 Thread Muqthar Ahmed
Thank you.it works.

Muqthar
DBA

-Original Message-
Sent: Tuesday, October 21, 2003 5:05 PM
To: Multiple recipients of list ORACLE-L


SELECT blah, blah, blah...
FROM (SELECT blah, blah, blah..., ROWNUM r 
FROM 
WHERE ...)
WHERE r = 2;

No guarantees, that you will be always getting the same row (depending
on in-line query).

Igor Neyman, OCP DBA
[EMAIL PROTECTED]



-Original Message-
Muqthar Ahmed
Sent: Tuesday, October 21, 2003 3:44 PM
To: Multiple recipients of list ORACLE-L

Hi,

Is there a way to pull ONLY 2nd row from the selected rows.

Thanks
Muqthar Ahmed
DBA
-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.net
-- 
Author: Muqthar Ahmed
  INET: [EMAIL PROTECTED]

Fat City Network Services-- 858-538-5051 http://www.fatcity.com
San Diego, California-- Mailing list and web hosting services
-
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.net
-- 
Author: Igor Neyman
  INET: [EMAIL PROTECTED]

Fat City Network Services-- 858-538-5051 http://www.fatcity.com
San Diego, California-- Mailing list and web hosting services
-
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.net
-- 
Author: Muqthar Ahmed
  INET: [EMAIL PROTECTED]

Fat City Network Services-- 858-538-5051 http://www.fatcity.com
San Diego, California-- Mailing list and web hosting services
-
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).


Re: How To Pull Second Row from 100 ROWS

2003-10-21 Thread Mark Burgess
Hi Muqthar,

have a look at the ROWNUM functionality. This may be
able to help you.

Regards,

Mark


 --- Muqthar Ahmed <[EMAIL PROTECTED]>
wrote: > Hi,
> 
> Is there a way to pull ONLY 2nd row from the
> selected rows.
> 
> Thanks
> Muqthar Ahmed
> DBA
> -- 
> Please see the official ORACLE-L FAQ:
> http://www.orafaq.net
> -- 
> Author: Muqthar Ahmed
>   INET: [EMAIL PROTECTED]
> 
> Fat City Network Services-- 858-538-5051
> http://www.fatcity.com
> San Diego, California-- Mailing list and web
> hosting services
>
-
> 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). 

http://personals.yahoo.com.au - Yahoo! Personals
New people, new possibilities. FREE for a limited time.
-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.net
-- 
Author: =?iso-8859-1?q?Mark=20Burgess?=
  INET: [EMAIL PROTECTED]

Fat City Network Services-- 858-538-5051 http://www.fatcity.com
San Diego, California-- Mailing list and web hosting services
-
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).


RE: How To Pull Second Row from 100 ROWS

2003-10-21 Thread Igor Neyman
SELECT blah, blah, blah...
FROM (SELECT blah, blah, blah..., ROWNUM r 
FROM 
WHERE ...)
WHERE r = 2;

No guarantees, that you will be always getting the same row (depending
on in-line query).

Igor Neyman, OCP DBA
[EMAIL PROTECTED]



-Original Message-
Muqthar Ahmed
Sent: Tuesday, October 21, 2003 3:44 PM
To: Multiple recipients of list ORACLE-L

Hi,

Is there a way to pull ONLY 2nd row from the selected rows.

Thanks
Muqthar Ahmed
DBA
-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.net
-- 
Author: Muqthar Ahmed
  INET: [EMAIL PROTECTED]

Fat City Network Services-- 858-538-5051 http://www.fatcity.com
San Diego, California-- Mailing list and web hosting services
-
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.net
-- 
Author: Igor Neyman
  INET: [EMAIL PROTECTED]

Fat City Network Services-- 858-538-5051 http://www.fatcity.com
San Diego, California-- Mailing list and web hosting services
-
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).


Re: How To Pull Second Row from 100 ROWS

2003-10-21 Thread Daniel Fink
Use an inline query.

select column1, column2
from (select rownum as i_rownum, column1, column2
 from tableA)
where i_rownum = 2;

Daniel Fink

Muqthar Ahmed wrote:

> Hi,
>
> Is there a way to pull ONLY 2nd row from the selected rows.
>
> Thanks
> Muqthar Ahmed
> DBA
> --
> Please see the official ORACLE-L FAQ: http://www.orafaq.net
> --
> Author: Muqthar Ahmed
>   INET: [EMAIL PROTECTED]
>
> Fat City Network Services-- 858-538-5051 http://www.fatcity.com
> San Diego, California-- Mailing list and web hosting services
> -
> 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.net
-- 
Author: Daniel Fink
  INET: [EMAIL PROTECTED]

Fat City Network Services-- 858-538-5051 http://www.fatcity.com
San Diego, California-- Mailing list and web hosting services
-
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).