To find 5th Highest salary from the table
SELECT TOP 1 SALARY FROM (SELECT DISTINCT TOP 5 SALARY FROM TblSalary ORDER BY SALARY DESC) a ORDER BY SALARY
To find 5th Lowest salary from the table
SELECT TOP 1 Salary FROM (SELECT DISTINCT TOP 5 Salary FROM TblSalary ORDER BY Salary ASC) a ORDER BY Salary desc
To find Minimum salary from the table
SELECT TOP 1 Salary FROM (SELECT DISTINCT TOP 1 Salary FROM TblSalary ORDER BY Salary ASC) a ORDER BY Salary
To find maximum salary from the table
SELECT TOP 1 Salary FROM (SELECT DISTINCT TOP 1 Salary FROM TblSalary ORDER BY Salary desc) a ORDER BY Salary
No comments:
Post a Comment