Re: MIN and MAX Query

From: TurkBear <john.greco_at_dot.state.mn.us>
Date: Thu, 20 Feb 2003 09:13:54 -0600
Message-ID: <e5s95vgr8o7i7b2ik1k9op5v3biinfr0l6_at_4ax.com>


[Quoted] 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..

[Quoted] "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 - 16:13:54 CET

Original text of this message