find nth Salary in SQL

PHOTO EMBED

Wed Feb 16 2022 08:18:31 GMT+0000 (Coordinated Universal Time)

Saved by @Bambibo9799

--find the 3rd and nth salary
select * 
from(
	select name, salary, 
	dense_rank()  over(order by salary desc)r
from tblemployee) as salarySort
where r in (2,3); -- find the salary based on the r value, sort by dense rank
content_copyCOPY