Retrieving field values of record found with MAX
Ruslan Zasukhin
sunshine at public.kherson.ua
Tue Nov 14 08:48:25 CST 2006
On 11/14/06 4:59 AM, "Steven Ronald" <stevenrt39 at yahoo.com.au> wrote:
> Ruslan,
>
> I have a database xdb:
>
> foo bar
> 4 3.3
> 2 4.5
> 9 1.8
>
> I want to find the value of "bar" for the record with
> the maximum value of "foo" (ie 1.8).
>
> Is there a way to do this with a single SQL statement?
>
> I tried this:
>
> cursorRef=valSQLSelect( dbRef_xdb, "SELECT
> MAX(foo),bar FROM x");
>
> but it doesn't work, I get "0" for bar.
This is wrong query.
You cannot MIX aggregative function with normal fields.
Try
SELECT MAX(foo),bar
FROM x
GROUP BY bar
--
Best regards,
Ruslan Zasukhin
VP Engineering and New Technology
Paradigma Software, Inc
Valentina - Joining Worlds of Information
http://www.paradigmasoft.com
[I feel the need: the need for speed]
More information about the Valentina
mailing list