Re: fist three higher values

From: Ken Papai <ken_at_kenpapai.com>
Date: Thu, 31 Jan 2002 19:03:07 GMT
Message-ID: <Lxg68.13703$dZ1.49602_at_rwcrnsc52.ops.asp.att.net>


"David A. Levy" <david.a.levy_at_rogers.com> ...

 >> can some one exlain how can i extract first three highest values from >> a same column in oracle, using a single query  

> Here is one example - using the EMP table in the SCOTT schema
> SQL> describe scott.emp
> Name Null? Type
> ----------------------------------------- -------- ----------------------
 --
> ----
> EMPNO NOT NULL NUMBER(4)
> ENAME VARCHAR2(10)
> JOB VARCHAR2(9)
> MGR NUMBER(4)
> HIREDATE DATE
> SAL NUMBER(7,2)
> COMM NUMBER(7,2)
> DEPTNO NUMBER(2)

>

> SQL> select sal from scott.emp
> 2 where rownum < 4
> 3 order by sal desc;

However this doesn't work if you have more than 3 rows in your table!

Ken Received on Thu Jan 31 2002 - 20:03:07 CET

Original text of this message