Thursday, 21 November 2013

How do I select 2nd highest salaried employee from my EMPLOYEE table?


How do I select 2nd highest salaried employee from my EMPLOYEE table?
Ans.

SELECT
EMPLOYEE.*, MAX(EMPLOYEE.Salary) AS SalarySecondHighest
FROM EMPLOYEE
WHERE EMPLOYEE.Salary<
(SELECT
MAX(EMPLOYEE.Salary) AS SalaryFirstHighest
FROM EMPLOYEE)

No comments:

Post a Comment

Popular Posts