Home » SQL & PL/SQL » SQL & PL/SQL » How to select "last but one row" from a table?????
How to select "last but one row" from a table????? [message #18667] Sun, 10 February 2002 18:05 Go to next message
Sarada
Messages: 27
Registered: April 2001
Junior Member
Hi All,

Please help me to find last but one row from a table. I need to get this based on an ID value which is a PK in other table.

Something like, Customers, OrderHeaders where they both have a 1:M relationship. I need to find the "last but one row" retrieving the OrderEntryDate for a given customer from the OrderHeader Table.

This is very URGENT!!!!!!!!

Thanks in Advance,

Sarada
Re: How to select [message #18685 is a reply to message #18667] Mon, 11 February 2002 02:27 Go to previous message
Sarada
Messages: 27
Registered: April 2001
Junior Member
select max(rowid) from table; this will show you the last but one row. If it is in peak hour it may give you some wrong result. If correct answer is needed make that tablespace offline first
Previous Topic: Can I assign an alias for a group of columns?
Next Topic: Determine first day of the quarter
Goto Forum:
  


Current Time: Sun May 31 18:32:35 CDT 2020