Solution :
For Highest Salary :
For 2Nd Highest Salary :
Find the nth highest salary using the TOP keyword in SQL Server :
For Highest Salary :
Select MAX(Salary) From EmployeeTable;
For 2Nd Highest Salary :
SELECT MAX(Salary) FROM EmployeeTable WHERE Salary NOT IN (SELECT MAX(Salary) FROM EmployeeTable )
Find the nth highest salary using the TOP keyword in SQL Server :
SELECT TOP 1 Salary FROM ( SELECT DISTINCT TOP N Salary FROM EmployeeTable ORDER BY Salary DESC ) AS Emp ORDER BY Salary
No comments:
Post a Comment