[V4WS 1.11] Re: Retrieving field values of record found with MAX

erne ernestogiannotta at tiscalinet.it
Thu Nov 16 10:29:29 CST 2006


Hi Steven,

on 16-11-2006 10:16, Steven Ronald at stevenrt39 at yahoo.com.au wrote:

> If I have a table x:
> 
> foo    bar   hooh
> 0.3    3       45
> 0.2    4       87
> 0.6    3       23
> 0.5    6       33
> 
> is it possible to use a single SQL statement to find
> the value of hooh for the record with the maximum
> value of foo (ie hooh=23)?
> 
> SELECT  MAX(foo),hooh FROM x GROUP BY hooh
> 
> does not work - it returns all 4 records.


What if 2 foo have the same value?

so 2 Select are in order here

SELECT  MAX(foo) FROM x
SELECT  hooh FROM x WHERE foo = <first query result>

Cool Runnings,
Erne.
-- 
| e r |  Ernesto Giannotta
| n e |  Musical Box - a media store
                   




More information about the Valentina mailing list