Is there a command akin to:
2nd highest salary from tbl_salary
or4th highest salary from tbl_salary
?
I've seen:
select salary
from tbl_salary t
where &n = (
select count(salary)
from(
select distinct salary
from tbl_salary
)where t.salary<=salary
);
How does this it works?
Are there other simple ways to get result?
Simplest Implementation,
SELECT sal from emp order by sal desc limit 1,1