Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: MIN and MAX Query
In message <b30v6f$i79$1_at_news7.svr.pol.co.uk>, Matty
<matt_at_slippeddisk.fsnenegspamt.co.uk> writes
>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
>
>
Simplest is
select empno, ename, sal
from emp
where sal = (select max(sal) from emp)
Cheers
Mike
-- Mike CoxReceived on Wed Feb 19 2003 - 17:16:55 CST