Hi...
How can we find out nth highest salray in any particular database?
Loading
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Dhaval PatelPosted Jan 20, 2012, 7:06 AM
use this query for nth Highest Salary
SELECT TOP 1 salary
FROM (
SELECT DISTINCT TOP n salary
FROM employee
ORDER BY salary DESC) a
ORDER BY salary
where n > 1 (n is always greater than one)
use below link for your reference
http://blog.sqlauthority.com/2008/04/02/sql-server-find-nth-highest-salary-of-employee-query-to-retrieve-the-nth-maximum-value/
http://www.c-sharpcorner.com/Blogs/7111/how-to-get-second-highest-and-lowest-record-in-sql-server.aspx