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
 SQL Server 2000 Forums
 Transact-SQL (2000)
 sql query

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2006-04-11 : 09:25:22
shilpa writes "I have a table created in my sql server.

the table contains the emp details withe salaries.

I want to write a query which displays the emp details having third highest salary or fourth highest salary."

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2006-04-11 : 09:34:48
[code]Select min(sal) from
(
select top 3 sal from yourTable order by sal DESC
) T
[/code]
Why is this question mostly asked in Interviews?

Madhivanan

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

twhelan1
Yak Posting Veteran

71 Posts

Posted - 2006-04-11 : 11:07:22
Because the employees having the third and fourth highest salaries are the ones being replaced by someone less qualified who asks for less money?

~Travis
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2006-04-12 : 05:44:45
quote:
Originally posted by twhelan1

Because the employees having the third and fourth highest salaries are the ones being replaced by someone less qualified who asks for less money?

~Travis




Madhivanan

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

- Advertisement -