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


Top 5 Contributors of the Month
david stephan

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))

OutPut:-

Name  Salary
CCCC  5000
BBBB  5000


     

Further Readings:

Responses

No response found. Be the first to respond this post

Post Comment

You must Sign In To post reply
Here

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