Re: Third largest salary

From: Steve Kass (skass_at_drew.edu)
Date: 05/12/04


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



Relevant Pages

  • Re: Health and Safety Advisor
    ... whether H&S stuff applies to volunteers. ... Where any organisation has at least one paid employee, ... The Management of Health and Safety at Work Regulations 1999 (ISBN 0 ... employee then the organisation is an employer and subject to H&S ...
    (uk.rec.scouting)
  • Re: SQL to combine required and completed training courses.
    ... write an SQL query that would result in rows that look like ... (EmpID, CourseID, DateTaken) ... for each employee and each ... required course in one result set? ...
    (comp.databases)

Quantcast