Friday 7 December 2012

Find nth top salary in MSSQl Server Query


use playwithjoinsbybookstore

select top 1 a.salary,name  from (select distinct top 3 salary ,name from Tbl_Employ order by salary desc ) as a order by salary 



and also with aggregate function 

select min(salary) from tbl_employ where salary in (select top 5 salary from tbl_employ order by salary desc

No comments:

Post a Comment