Home » RDBMS Server » Server Administration » how to get Nth row from table
how to get Nth row from table [message #59807] Wed, 24 December 2003 03:43 Go to next message
dilip kumar
Messages: 111
Registered: December 2003
Senior Member
hi how to get Nth row from a table
i.e i need to get only 4th row
Re: how to get Nth row from table [message #59812 is a reply to message #59807] Wed, 24 December 2003 06:18 Go to previous message
Thiru
Messages: 1089
Registered: May 2002
Senior Member
There is no such thing as 'Nth row of a table'. If you meant 'Nth row from a result set' ,

SQL> create table t as select rownum X from all_objects where rownum < 100;

Table created.

SQL> select x from ( select x,ROW_NUMBER() over (order by x ) RN from t) X where X.RN=4;

X
----------
4

SQL> select x from ( select x,ROW_NUMBER() over (order by x DESC) RN from t) X where X.RN=4;

X
----------
96

HTH
Thiru
Previous Topic: Difference between Index Rebuild online and Coalesce
Next Topic: database size
Goto Forum:
  


Current Time: Fri Sep 20 10:29:35 CDT 2024