.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Imran Ghani

Post New Resource Bookmark and Share   

List the Name of Employees who are taking the 2nd highest salary using SqlServer?

Posted By:Syed Shakeer Hussain       Posted Date: March 14, 2010    Points: 10    Category:    URL: http://www.dotnetspark.com  

query for to know the list of Employees who are taking the 2nd highest salary

Below is the data which is present in a table

ID  Name  Salary
1    AAAA    10000
2    CCCC    5000
3    BBBB    5000
4   DDDD    3000
5    EEEE   3555

Sql Query:-select Name,salary from employee where salary=(select min(salary) from employee where salary in (select top 2 salary from employee order by salary desc))


Name  Salary
CCCC  5000
BBBB  5000


Further Readings:


No response found. Be the first to respond this post

Post Comment

You must Sign In To post reply

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend