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

Home -> Community -> Usenet -> c.d.o.server -> Re: Simple Query of multiple record

Re: Simple Query of multiple record

From: Heggelund <d92hegge_at_ix_prod.hfk.mil.no>
Date: 1997/03/20
Message-ID: <1997Mar20.133928.5516@ix_prod.hfk.mil.no>#1/1

Hi

this query should work:

select name,sal
from emp e1
where 3 > (select count(*)

            from   emp e2
            where  e2.sal < e1.sal
           )

order by sal
/

Rgds
Steinar Heggelund

Joseph Jao (jjao_at_idt.net) wrote:
: Hi, I tried to make a simple SQL command query to get the names of 3 top
: paid persons. "Select name, sal from emp where rownum<4 order by sal
: desc;" doesn't work. "Select name, sal from emp order by sal desc;"
: works but it'll bring everything. Can anyone help me?
 

: jjao_at_idt.net

--

----------------------------------------------------------------------------
I'm employed in the Norwegian consulting company Opus One AS. 
I have 7 years experience with Oracle products, mainly the database. 
We are a small company which offers consulting services in design,
implementation and tuning of databases and applications based on Oracle.
Received on Thu Mar 20 1997 - 00:00:00 CST

Original text of this message

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