Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: MIN and MAX Query
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:Received on Wed Feb 19 2003 - 18:23:15 CST
> 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
>
>