How to retrieve the 2nd record from a table ?

How to retrieve the 2nd record from a table which has say 1000 records in it. Please answer this without using the row-id? I tried to say a query "select * from table where rowcount=1" which worked well and also "select * from table where rowcount=3" which gave me the result but not when I did the same query "select * from table where rowcount=2" ? why?

Questions by anabarai   answers by anabarai

Showing Answers 1 - 7 of 7 Answers

Tapas Ranjan gaan

  • Jul 15th, 2011
 

Code
  1.  

or
Code
  1.  

  Was this answer useful?  Yes

pallis

  • Jul 28th, 2011
 

Code
  1.  

or
Code
  1.  

NOTE: Columns must be SAME DATA TYPE

  Was this answer useful?  Yes

sivanagireddy

  • Aug 6th, 2011
 

Code
  1.  

  Was this answer useful?  Yes

Baurisetty Dhiraj

  • Aug 28th, 2011
 

select * from (select * from (select * from table_name where rownum<=2) order by rownum desc) where rownum<=1

  Was this answer useful?  Yes

smonroy

  • Sep 27th, 2011
 

the best way to issue is

select top 1 * from cars where id_car in
(select top 2 id_car from cars order by id_car)
order by id_car DESC

and with that
obtain the second record (This way is for the PK)

  Was this answer useful?  Yes

rima

  • Nov 24th, 2011
 

Code
  1. span style="color: #ff0000;">`table_name`

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions