Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Other Forums
 Other Topics
 select query

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2005-07-18 : 08:04:49
sheel writes "if u have a table that contain the datail of empolyees.
how can u find out the name of employee who's salary is second highest salary .
please solve my problem
thank u"

AndrewMurphy
Master Smack Fu Yak Hacker

2916 Posts

Posted - 2005-07-18 : 08:54:21
Sounds like homework!
C'mon....put some effort into it yourself!
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2005-07-18 : 09:04:09
I think this may be one of the most asked questions in the forums
Refer this
http://www.sqlteam.com/item.asp?ItemID=16134

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

chetancool
Starting Member

34 Posts

Posted - 2005-07-18 : 09:42:37
HI..

Or u can try this query (taken only from the link provided by madhivanan)

Select * From Emp E1 Where (2-1)=
(Select Count(Distinct(E2.Salary)) From Emp E2 Where
E2.Salary > E1.Salary)
Here 2-1 means u want to know detail of second highest salaried person.
Go to Top of Page
   

- Advertisement -