Re: Third largest salary
From: Steve Kass (skass_at_drew.edu)
Date: 05/12/04
- Next message: Ashish Patel: "Want to Know Colunm exist or not"
- Previous message: anonymous_at_discussions.microsoft.com: "Select statement"
- In reply to: mustafa: "Third largest salary"
- Next in thread: MUSTAFA: "Re: Third largest salary"
- Reply: MUSTAFA: "Re: Third largest salary"
- Messages sorted by: [ date ] [ thread ]
Date: Tue, 11 May 2004 23:08:31 -0400
-- if you want only one row, even if there are others with the same salary
select top 1 * from (
select top 3 * from Employee
order by Salary
) T
order by Salary desc
-- if you want to include ties:
select top 1 with ties * from (
select top 3 with ties * from Employee
order by Salary
) T
order by Salary desc
Steve Kass
Drew University
mustafa wrote:
>Dear Sir
>
>I want to retrive data that will return 3rd largest salary
>paid employee from employee table using sql query.
>
>thanks
>
>
- Next message: Ashish Patel: "Want to Know Colunm exist or not"
- Previous message: anonymous_at_discussions.microsoft.com: "Select statement"
- In reply to: mustafa: "Third largest salary"
- Next in thread: MUSTAFA: "Re: Third largest salary"
- Reply: MUSTAFA: "Re: Third largest salary"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|