Re: MIN and MAX Query

From: Henk Hultink <hhu_at_stopspam.stoas.nl>
Date: Thu, 20 Feb 2003 12:27:02 +0100
Message-ID: <3e54bb87$1_at_news.wau.nl>


Hi,

try

select empno, ename, sal
from emp
where sal in

     ( select min( sal )
       from   emp
       union
       select max( sal )
       from   emp
     )

/

regards,

Henk

--
H. Hultink
Software Engineer
Stoas, Division OBOI
Wageningen, The Netherlands
"Activating Knowledge"
http://www.stoas.nl

e-mail: hhu_at_stopspam.stoas.nl

"Matty" <matt_at_slippeddisk.fsnenegspamt.co.uk> wrote in message
news:b30v6f$i79$1_at_news7.svr.pol.co.uk...

> Hi All
>
> Just starting out making queries with SQL and have become stumped, and am
> looking for help!
>
> Table is called emp, with the following fields:
>
> EMPNO
> ENAME
> SAL
>
> I need to write a query to show the employees name and salary of the
highest
> and lowest salary earner.
>
> I have worked it out to show the highest and lowest salaries but cannot
get
> it together with the name!!
>
> I would appreciate your help here!
>
> Many thanks in advance
>
> Matty
>
>
Received on Thu Feb 20 2003 - 12:27:02 CET

Original text of this message