What you want to see on DotNetFunda.com ?
DotNetFunda.Com Logo
Twitter TwitterLinkedIn
YouTubeGoogle
 Online : 15969 |  Welcome, Guest!   Register  Login
 Home > Interview Questions > SQL Server Interview Questions > We have an employee salary table, how do ...

We have an employee salary table, how do we find the second highest from it ?

Interview question and answer by: Bharathi Cherukuri | Posted on: 4/25/2012 | Category: SQL Server Interview questions | Views: 686 | | Points: 40


Answer:

You can use the below query to find out the second highest salary from employee salary table.

SELECT * FROM TblEmployeeSalary a WHERE (2=(SELECT COUNT(DISTINCT(b.salary)) FROM TblEmployeeSalary b WHERE b.salary>=a.salary))

Asked In: Many Interviews | Alert Moderator 
Found interesting? Add this to:


 Responses

Posted by: Ras90it | Posted on: 26 Apr 2012 04:37:24 AM | Points: 10 | Alert Moderator 

Thank for Info.

Here What is meant by a & b. please explain clearly

Thanks in advance


>> Write Response - Respond to this post and get points

Even more ... | Submit Interview Questions and win prizes!

More Interview Questions from Bharathi Cherukuri

Even more ... | Submit Interview Questions and win prizes!


About Us | Contact Us | The Team | Advertise | Software Development | Write for us | Testimonials | Privacy Policy | Terms of Use | Link Exchange | Members | Go Top
General Notice: If you find plagiarised (copied) contents on this page, please let us know the original source along with your correct email id (to communicate) for further action.
Copyright © DotNetFunda.Com. All Rights Reserved. Copying or mimicking the site design and layout is prohibited. Logos, company names used here if any are only for reference purposes and they may be respective owner's right or trademarks. | 5/24/2013 4:39:29 PM