how to find nth highest salary

Answer Posted / amit

select * from emp as e1 where sal (n-1) = select distinct
(count(*) from emp as e2 where e2.sal>e1.sal)

Where n is no that u want which postion's salary u want
suppose second higest means n=2

Amit

Is This Answer Correct ?    6 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are the rendering extensions of ssrs?

105


Tell me what are the essential components of sql server service broker?

508


What is the purpose of forms?

493


Explain the difference between functions and stored procedures in sql server?

476


What are the five major components of a dbms?

510






What is create statement?

527


Describe in brief system database.

540


What are the triggers in sql?

555


What is query and its types?

510


What is store procedure? When do you use?

523


Do you know what are the properties of the relational tables?

573


What it means to be triggered?

498


Mention what are the different types of ssrs reports?

98


Write a query for primary key constraint with identity key word?

571


Why SQL Agent is used?

594