Inscrivez-vous ou connectez-vous pour rejoindre votre communauté professionnelle.
SELECT TOP1 salary FROM (SELECT TOP3 salary FROM Table_Name ORDER BY salary DESC) AS Q ORDER BY salary ASC
select top 1 salary from
(select distinct top 3 salary form table_name
order by salary )
result
order by salary desc
As I understood your question you can do it by using analytical functions, as example:
select n.* from(select p.id, p.salary, rank() over (order by p.salary desc) as cn from(select 1 as id,1000 as salary union select 2,1500 union select 3,2500 union select 4,1200) as p)n where n.cn=3
SELECT TOP1 Sal
FROM ( SELECT DISTINCT TOP3 Sal
FROM Salary
ORDER BY Sal DESC ) AS ThirdSal ORDER BY Sal