Thursday, August 28, 2014

How to retrieve 5th highest salary in a single statement

If you want to use correlated subquery method use this



SELECT DISTINCT Salary
FROM Table t
WHERE EXISTS(SELECT 1
FROM Table
WHERE Salary > t.Salary
HAVING COUNT(DISTINCT Salary) = 4
)





Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://ift.tt/19nLNVq http://ift.tt/1iEAj0c


No comments:

Post a Comment