Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> comp.databases.oracle -> Re: top 5 ( or n) salaries in each department

Re: top 5 ( or n) salaries in each department

From: Dmitry E. Loginov <lde_at_mpsb.ru>
Date: Fri, 21 May 2004 10:12:36 +0400
Message-ID: <c8k6kj$1ecd$1@news.caravan.ru>


Read the "Functions" chapter of the Oracle SQL Reference for "analytic functions".

In Oracle 8i or higher you should write SQL like following:

select * from (
  select DepName, Salary, row_number() over (partition by DepName order by Salary desc) RK from SALARYTABLE
) where RK<=5

"Niy" <niy38_at_hotmail.com> wrote in message news:55dd405a.0405202107.79a203ed_at_posting.google.com...
> how to get that with SQL query?
Received on Fri May 21 2004 - 01:12:36 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US