Page 1 of 1

Getting information out of MYSQL

Posted: Sat 07 Apr 2007 01:34
by kaffeburk
Is there any simple way to get for example the mid value for a selcted column?

I guess i could create SQL code to transfer that value to a specific cell, and then read it...

Posted: Tue 10 Apr 2007 08:16
by Antaeus
You can do this using code like this:

Code: Select all

  MyQuery.SQL.Text := 'SELECT AVG(field_name) FROM table_name';
  MyQuery.Open;
  ShowMessage('Average value: ' + MyQuery.Fields[0].AsString);
For more information on functions like AVG read the MySQL Reference Manual.