please tell me the query to get details of the employee
having the second largest salary

Answer Posted / roshan

select employeeid, employeeName ,Salary from table1 where
Salary =(select min(a.Salary) from table1 inner join
(select top 2 Salary from table1
order by Salary desc) a on table1.Salary = a.Salary)

if we change the top value we will get the n'th largest
salary

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 use old values to define new values in update statements in ms sql server?

668


How to create function without parameter in sql server?

545


What is the datatype of rowid?

494


What are secondary xml indexes?

550


What is a fill factor?

610






How to select all columns of all rows from a table with a select statement in ms sql server?

561


What does it mean to invest in the index?

495


What does executeupdate return?

526


What is sql server locking?

542


What is join and name different type of joins?

562


What is the most common trace flags used with sql server?

500


What is the architecture of ms sql reporting service?

511


Can we do dml on views?

542


What is the difference between varchar and nvarchar?

511


Explain cursor as data base object?

564