how to find nth highest salary

Answer Posted / harshal

Below query is written assuming table "employee" has a column called "salary".
select salary from (select salary from (select distinct(salary) from employee order by salary desc)where rownum<n) order by salary asc where rownum<1;

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How to throw custom exception in Stored Procedure?

673


How to execute a stored procedure in ms sql server?

648


Do you know what is fill factor and pad index?

655


How do I partition a table in sql server?

624


You have modified 100 store procedures and want to replicate these changes from development to prodution, and production can have users using the Server/DB, how would you replicate without causing issues?

1809






John exports information periodically from a microsoft sql server database to an oracle database what is the best way to do this?

606


How do I uninstall sql server 2014?

593


What are the options which must be set to allow the usage of optimistic models?

608


What are the differences between char and varchar in ms sql server?

660


Is it safe to delete log files?

597


What are the basic functions for master, msdb, model, tempdb and resource databases?

657


What is bookmark link in ssrs?

116


Why are sql functions used?

689


What are the types of subscriptions in SQL Server replication?

630


How to return the top 5 rows from a select query in ms sql server?

687