GeekInterview.com
   Home |  Tech FAQ  |   Interview Questions |  Placement Papers |  Tech Articles |  Learn |  Freelance Projects |  Online Testing |  Geeks Talk |  Job Postings |  Knowledge Base | Site Search |  Add/Ask Question

GeekInterview.com  >  Interview Questions  >  Database  >  MYSQL
Go To First  |  Previous Question  |  Next Question 
 MYSQL  |  Question 39 of 45    Print  
How to display nth highest record in a table for example ?
select salary from tablename order by desc limt 4;


  
Total Answers and Comments: 3 Last Update: June 17, 2008     Asked by: Vishwapati Mishra 
  
 Sponsored Links

 
 Best Rated Answer

No best answer available. Please pick the good answer available or submit your answer.
December 17, 2007 01:10:39   #1  
prisharma Member Since: December 2007   Contribution: 3    

RE: How to display nth highest record in a table for example ?

Select sal From emp X Where 3 =

( Select Count(Distinct sal) From emp Where sal >=X.sal )


 



 
Is this answer useful? Yes | No
February 14, 2008 05:13:44   #2  
sampra Member Since: February 2008   Contribution: 279    

RE: How to display nth highest record in a table for example ?

select amt From Emp X Where 3 =

( select count(distinct sal) From emp where sal >=X.sal )


 
Is this answer useful? Yes | No
June 17, 2008 15:57:50   #3  
eswarqa Member Since: April 2008   Contribution: 3    

RE: How to display nth highest record in a table for example ?
select sal from emp order by sal desc limit 3, 1;

This will select the 4th highest salary from emp table, i.e picks up after the third, next value

 
Is this answer useful? Yes | No


 
Go To Top


 Sponsored Links

 




About Us  |   Privacy Policy  |   Terms and Conditions  |   Contact  |   Site Map  |   Add Question  |   Propose Category  |   RSS Feeds  |   Articles Sitemap  |   Site Updates  |   Add Resource

Copyright © 2005 - 2008 GeekInterview.com. All Rights Reserved
Page copy protected against web site content infringement by Copyscape