Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: MIN and MAX Query
Try something along these lines:
select 'Highest Paid',a.ename,a.sal,
'Lowest Paid',b.ename ,b.sal
from emp a,emp b
where a.sal = (select max(sal) from emp)
and b.sal = (select min(sal) from emp)
Will need some tweaking to fix any duplicates but should be an approach to try..
"Matty" <matt_at_slippeddisk.fsnenegspamt.co.uk> 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 Thu Feb 20 2003 - 09:13:54 CST