select top 1 salary from(select top 6 salary from employee order by salary desc)asc
On Sat, Aug 6, 2011 at 6:40 PM, Reynald <[email protected]> wrote: > Could anyone please explain me how this query selects the employee > with nth highest salary? > > select last_name, salary from employees e1 > where &n = (select count(distinct(salary)) from employees e2 > where e2.salary >= e1.salary); > > -- > You received this message because you are subscribed to the Google Groups > "Algorithm Geeks" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/algogeeks?hl=en. > > -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
