Start networking and exchanging professional insights

Register now or log in to join your professional community.

Follow

Write a query to find second highest salary of an employee?

user-image
Question added by Muhammad Shahid Farooq , Software Engineer, System Integrator , ForeVision Business Solutions
Date Posted: 2017/03/16

SELECT Name FROM   Employees WHERE  Salary = (SELECT MIN(Salary) FROM   (SELECT DISTINCT TOP (2) Salary FROM   Employees ORDER  BY Salary DESC) T);

Muhammad Arshad Gondal
by Muhammad Arshad Gondal , Daputy Manager IT , NOON SUGAR MILLS LIMITED

SELECT MAX(SALARY) FROM MASTER WHERE SALARY NOT in(SELECT MAX(SALARY) from master)

 

Muhammad Waqar Arif
by Muhammad Waqar Arif , Senior Database Architect , FINCA Microfinance Bank Limited

SELECT TOP 1 Salary FROM ( SELECT TOP 2 Salary FROM Employee ORDER BY Salary DESC) AS Employee ORDER BY Salary ASC;

Atiqul Islam
by Atiqul Islam , Sr Software Engineer , Prism Informatics Ltd

SELECT MAX(Salary) FROM Employee WHERE Salary NOT IN (SELECT MAX(Salary) FROM Employee )

Shakir Ali
by Shakir Ali , Full Stack Developer , https://www.freelancer.com

Select Top 1 Salary From

(Select Distinct Top 2 

Salary from tblEmployee

Order by Salary)

Result

Order by Salary 

More Questions Like This