.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
 
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
david stephan

Home >> Code Snippets >> SQL Query >> Post New Resource Bookmark and Share   

 Subscribe to Code Snippets

How to find nth highest value?

Posted By:Shashi Ray       Posted Date: September 21, 2008    Points: 10    Category: SQL Query    URL: http://www.dotnetspark.com  
 

Below is the sample SQL Query to find out the nth highest Salary. This question aslo asked in so many interviews also it an important SQL Query useful to find nhighest in a table sets see the query.

Below is the example from an Employee which has a salary column in it .

Q. How to find nth highest salary?

SELECT TOP 1 salary
FROM (SELECT DISTINCT TOP n salary
FROM employee
ORDER BY salary DESC) a
ORDER BY salary 

 


     

Further Readings:

Responses

No response found. Be the first to respond this post

Post Comment

You must Sign In To post reply
Find More code samples in C#, ASP.Net, Vb.Net and more Here

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend