Re: Select f1, min(f2) ????

From: Almut Herzog <al-her_at_sectra.se>
Date: 1996/05/13
Message-ID: <3197420A.DF3_at_sectra.se>#1/1


Konstantin Kivi wrote:
>
> Hello All
>
> Could someone point out if there a way
> of selecting two fields from the table when one
> field reaches for example its minimum.
>
> I don't like the following because I think
> that it may be done more efficiently, because
> f1 is found at the time of subquery.
>
> select f1, f2 from t1 where f2=min( select f2 from t1
> where (<<criteria>>));
>
> For simplicity lets assume that all f2 are different.
>
> Konstanti

"ORACLE - the complete reference" is not wiser than you, so I guess there is no better solution. Chapter 6: Finding Rows with MAX or MIN:

"Which city had the highest temperature ever recorded?"

select City, Temperature from T1 where Temperature = (select MAX(Temperature) from T1);

-- 
Almut Herzog
SECTRA Secure Transmission AB       e-mail: al-her_at_sectra.se
Teknikringen 2                      voice:  ++46 13 235221
583 30 Linkoping                    fax:    ++46 13 212185
SWEDEN
Received on Mon May 13 1996 - 00:00:00 CEST

Original text of this message