How to select a last row in sybase

Showing Answers 1 - 4 of 4 Answers

shamimaziz

  • Jul 21st, 2007
 

From ASE 12.5.3
select top 1  * from <tablename> order by <key>  desc

Prior ASE 12.5.3

set rowcount 1
select top 1  * from <tablename> order by desc
set rowcount 0 ( this will reset the option you set)

  Was this answer useful?  Yes

jdx

  • Aug 7th, 2007
 

select  * from <tablename> where <key> = (select max(<key>) from <tablename> )

  Was this answer useful?  Yes

gcvpgeek

  • Mar 4th, 2009
 

Use the below query

select * from table1 minus select * from table1 where rownum < (select count(1) from table1)

  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