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

What are the indexes in sql server?

705


What is the stuff and how does it differ from the replace function?

731


List the different normalization forms?

707


Why do we need different type of parameter?

746


What are the restrictions that views have to follow?

719






How except clause is differs from not in clause?

700


Can I disable or restrict ssrs export formats (rendering formats)?

126


What is spid in sql server profiler?

726


explain the storage models of olap? : Sql server database administration

676


What are the advantages of sql stored procedure?

754


How to invoke a trigger on demand?

723


1)what is the difference between Reinitializing a Subscription and synchronization the subscription? 2)when to use reinitializing ? 3)when to use synchronization? 4)when adding table or deleting a table what to do?(reinz.. or syn) 5)when adding a column what to do?

1726


Explain sql server authentication modes?

784


Why are sql functions used?

768


Which rendering formats are affected by the pagesize properties?

122