Board index » delphi » max min avg sum in local tables andd queries

max min avg sum in local tables andd queries

How can I get max min avg  sum count   we've used in Paradox using Delphi?
I want to retrieve these data in some variable in the code. Can I do that?

Adriano

 

Re:max min avg sum in local tables andd queries


Easy -- just write a query and run it.

Example:
SELECT Avg(InvoiceTotal) AS AverageSale FROM INVOICES.DB

In code:

   with AQuery do
      begin
         SQL.Clear;
         SQL.Add('SELECT Avg(InvoiceTotal) AS AverageSale');
         SQL.Add('FROM INVOICES.DB');
         SQL.Add('WHERE ...');
         SQL.Add('ORDER BY ...');
         Prepare;
         Open;
         while not EOF do
            begin
               curAverageSale := FieldByName('AverageSale').Value;
               { do something with curAverageSale here }
               Next;
            end;
         Close;
      end;

Take a look at the Local SQL Help file for more info on
these functions.

Adriano F C Pinto wrote in message <6v5o8d$8e...@forums.borland.com>...

Quote
>How can I get max min avg  sum count   we've used in Paradox using Delphi?
>I want to retrieve these data in some variable in the code. Can I do that?

>Adriano

Re:max min avg sum in local tables andd queries


Use a TQuery and

SELECT MAX(SomeField) FROM SomeTable

--
Bill Todd
(Sorry but TeamB cannot answer questions received via email)
(Remove nospam from my email address to contact me for any other reason)

Other Threads