Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: MIN and MAX Query
In message <9j9+BKEJXgV+EwMj_at_ntlworld.com>, Mike
<mike_at_nospam.demon.co.uk> writes
>In message <74a9c367.0302210204.6d5a5808_at_posting.google.com>,
>Thorsten Kettner <thorsten.kettner_at_web.de> writes
>>"Matty" <matt_at_slippeddisk.fsnenegspamt.co.uk> wrote in message
>>news:<b33k4t$gsq$1_at_news8.svr.pol.co.uk>...
>>
>>Hi Matty,
>>
>>Mike's answer is correct. What error do you get?
>>
>>Here is the complete statement:
>>
>> select
>> empno, ename, sal
>> from
>> emp
>> where
>> sal = (select max(sal) from emp) or
>> sal = (select min(sal) from emp);
>
>or just to tidy it up a tiny bit
>
>select empno, ename, sal
>from emp
>where sal in (select min(sal),max(sal) from emp)
>
>Cheers
>
Oh dear 2nd go
select empno, ename, sal
from emp
where sal in
(select max(sal) a from emp
union
select min(sal) a from emp)
-- Mike CoxReceived on Fri Feb 21 2003 - 08:50:57 CST
![]() |
![]() |