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

Ivan Smahin ivan_smahin at valentina-db.com
Thu Nov 16 11:33:35 CST 2006


Hello Steven,

Thursday, November 16, 2006, 11:16:35 AM, you 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.

You can try something like this:

SELECT
      max(hooh)
FROM
    x
WHERE
     foo = (SELECT max(foo) from x)
     



-- 
Best regards,
 Ivan                            mailto:ivan_smahin ÎÁ valentina-db.com



More information about the Valentina mailing list