Query to get max and second max in oracle in one query ?
Answer
select sal from (select dense_rank() over(order by sal) rank
from emp) where rank in(1,2);
In above query you will get both highest and second highest
salary details even there are more people who are getting
highest and second highest salary.