from the table display the 2nd highest salary?
and also the least 2nd salay?

Answer Posted / sridhar sahoo

select distinct top 1 salary from payroll..emp where salary
in(select distinct top N salary from payroll..emp order by
salary desc)

if u want top 2 put 2 at the pacece of N
if u want top 5 put 5 at the pacece of N
if u want ..............................

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How can you stop stored procedures from recompiling?

642


Why is the need for data conversion transformations?

692


How to sort the query output with order by clauses in ms sql server?

815


How you can find out if an index is useful to the optimizer?

660


What is self contained multi valued query?

741






What are security principals used in sql server 2005?

658


What is b tree index?

678


What new data source types were added in ssrs 2014?

130


What is the difference between for xml raw and for xml auto?

741


What are three ways you can use an identity value inside a trigger? Why would you prefer one way over another?

744


Can two tables share a primary key?

714


What is read uncmmited?

788


Why olap is used?

721


Explain the difference between clustered and non-clustered index?

685


you added a row to a view, but the row is not shown on the view. Explain how this can happen, and how you can remedy the situation

709