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

Home -> Community -> Usenet -> c.d.o.misc -> Re: MIN and MAX Query

Re: MIN and MAX Query

From: Ron Reidy <rereidy_at_indra.com>
Date: Wed, 19 Feb 2003 17:23:15 -0700
Message-ID: <3E541FF3.2010206@indra.com>


select max(sal), empno, ename
from emp
group by empno, ename
union
select min(sal), empno, ename
from emp
group by empno, ename
order by 1

--
Ron Reidy
Oracke DBA

Matty wrote:

> 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 Wed Feb 19 2003 - 18:23:15 CST

Original text of this message

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