Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- WITH CTE AS
- (
- SELECT DepartmentID, SALARY,
- DENSE_RANK() OVER (PARTITION BY DepartmentID ORDER BY SALARY DESC ) RANK_SALARY
- FROM Employees
- )
- SELECT DISTINCT (DepartmentID), SALARY AS ThirdHighestSalary
- FROM CTE
- WHERE RANK_SALARY = 3;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement