how to find nth highest salary

Answer Posted / rahul tripathi

The Genral answer which can work on any SQL:-

select salary from emp e1 where (n-1)=(select count(*)
from emp where salary > e1.salary )

Rahul Tripathi

rahultripathi@inkanpur.com

Is This Answer Correct ?    249 Yes 76 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

can a database be shrunk with users active? : Sql server administration

563


Can a table be moved to different filegroup?

568


How to view the error log for any specific instance? : sql server database administration

577


Can you explain powershell included in sql server 2008?

503


What are the results of running this script?

509






Give some Scenario for Non Clusterd index? Can we write system defined functions in side The Function? Wat is the Unique Datatype?

2082


What is 2nf normalization?

537


What is a collation?

592


How to maintain a fill factor in existing indexes?

528


How many levels of sp nesting are possible?

552


What is implicit mode in sql server?

558


We need to perform what steps in the following order to work with a cursor?

709


Do you think BCNF is better than 2NF & 3NF? Why?

786


How to retrieve error messages using odbc_errormsg()?

538


How do I create a stored procedure in sql server?

517