GeekInterview.com
  I am new, Sign me up!
 
GeekInterview.com  >  Interview Questions  >  Database  >  Sybase
Go To First  |  Previous Question  |  Next Question 
 Sybase  |  Question 33 of 64    Print  
How to select a last row in sybase

  
Total Answers and Comments: 4 Last Update: March 08, 2009     Asked by: aruna 
  
 Sponsored Links

 
 Best Rated Answer

No best answer available. Please pick the good answer available or submit your answer.
July 21, 2007 02:21:46   #1  
shamimaziz Member Since: July 2007   Contribution: 8    

RE: How to select a last row in sybase
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)

 
Is this answer useful? Yes | No
August 07, 2007 17:44:48   #2  
jdx        

RE: How to select a last row in sybase
select * from <tablename> where <key> (select max(<key>) from <tablename> )
 
Is this answer useful? Yes | No
March 04, 2009 06:34:42   #3  
gcvpgeek Member Since: March 2009   Contribution: 9    

RE: How to select a last row in sybase
Use the below query

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

 
Is this answer useful? Yes | No
March 08, 2009 12:53:11   #4  
efficasy Member Since: March 2009   Contribution: 1    

RE: How to select a last row in sybase
Set rowcount 1
Select col_name from table_name order by col_name desc

 
Is this answer useful? Yes | No


 
Go To Top


 Sponsored Links

 
About Us -  Privacy Policy -  Terms and Conditions -  Contact -  Ask Question -  Propose Category -  Site Updates 

Copyright © 2005 - 2009 GeekInterview.com. All Rights Reserved

Page copy protected against web site content infringement by Copyscape