Select distinct(sal) from employee A where 5=(Select count(distinct(sal)) from employee B where A.sal<=B.sal)
Select sal from employee A where 5=(Select count(sal) from employee B where A.sal<=B.sal)
Last word
SELECT TOP 1 salary FROM (SELECT DISTINCT TOP 5 salary FROM employee ORDER BY salary DESC) a ORDER BY salary
Cheers www.SQLServerbuddy.blogspot.com iLink Multitech Solutions
Login to post response