Click here to Skip to main content
Click here to Skip to main content
Articles » Database » Database » General » Alternatives
 
Alternatives (2)

Tagged as

nth Highest Salary in SQL Server 2005

, 16 Feb 2011 CPOL

Alternatives

Members may post updates or alternatives to this current article in order to show different approaches or add new features.

16 Feb 2011
thatraja
SELECT TOP 1 salaryFROM (SELECT DISTINCT TOP n salaryFROM employeeORDER BY salary DESC) aORDER BY salarywhere n > 1SQL SERVER – Find Nth Highest Salary of Employee – Query to Retrieve the Nth Maximum value[^]
18 Apr 2011
Costica U
The original solution has some issues. Check the following script:IF OBJECT_ID('tempdb..#salary') IS NOT NULL BEGIN DROP TABLE #salary ENDCREATE TABLE #salary ( Salary INT )INSERT INTO #salary(Salary) VALUES(5) -- 1INSERT INTO #salary(Salary)...

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

Mohd_Ahmad

India India
No Biography provided

| | Privacy | Terms of Use | Mobile
Web03 | 2.8.1411028.1 | Last Updated 16 Feb 2011
Article Copyright 2011 by Mohd_Ahmad
Everything else Copyright © CodeProject, 1999-2014
Layout: fixed | fluid