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

Do you know what is recursion? Is it possible for a stored procedure to call itself or recursive stored procedure?

752


What are group functions in query statements in ms sql server?

725


What Is Rdbms?

840


What is GUID in sql server?

821


How to create database with physical files specified in ms sql server?

722






How do I start sql server?

698


What are the transaction properties?

733


What is a scheduled job or what is a scheduled task?

709


When we should use @@error?

703


What are the differences between union, intersect, and minus operators?

761


How many non clustered indexes there can be on table ?

670


What is database architecture? : SQL Server Architecture

737


What type of Index will get created after executing the above statement?

842


What does normalization do to data?

723


Explain syntax for disabling triggers?

707