how to find nth highest salary

Answer Posted / anand patel.

It is a very generic and easy way to find the Nth higest
salary with there employee/s name.

select * from emp where salary =
(select max(salary) from emp where salary in
(select top (select (count(*)-(n-1))from emp) salary
from emp order by salary))

Is This Answer Correct ?    2 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How retrieve field names from the table in SQL through JAVA code?

1476


How you can change the database name in SQL SERVER?

760


How to list all user names in a database?

669


What are the differences between “row_number()”, “rank()” and “dense_rank()”?

614


Differentiate between ms sql server reporting services vs crystal reports?

574






What is SQL Server?

752


What do we need queues in sql service broker?

605


What is the use of commit?

648


What is recompile sql server?

657


What is sql server database?

579


What is the purpose of a table?

612


Define full outer join?

606


What is table join?

693


How to list all tables in the database using odbc_tables()?

653


What is nolock hint in sql server 2008

721