Freerider
asked on
SQL MAX function
Hi all,
I'm trying to display the highest value from a table,
using the following code:
---
Query2.SQL.Add('SELECT MAX(Price1) AS maxprice');
Query2.SQL.Add(' FROM CustomDTL');
Query2.ExecSQL;
showmessage(FloatToStr(max price));
---
This isn't returning the result I expect.
How do I get the value "maxprice" out of the query?
Thanks,
Freerider,
I'm trying to display the highest value from a table,
using the following code:
---
Query2.SQL.Add('SELECT MAX(Price1) AS maxprice');
Query2.SQL.Add(' FROM CustomDTL');
Query2.ExecSQL;
showmessage(FloatToStr(max
---
This isn't returning the result I expect.
How do I get the value "maxprice" out of the query?
Thanks,
Freerider,
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks kretzschmar,
without the "Query2.Open;" it wouldn't have worked.
But I didn't realise I had to create a new field for "MaxPrice".
Freerider.
without the "Query2.Open;" it wouldn't have worked.
But I didn't realise I had to create a new field for "MaxPrice".
Freerider.
But you must Doubleclick your Tquery, and Add the Fields in order to make persistant fields.
Best Regards.
Marcos.