Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Sum a paradox column?

Status
Not open for further replies.

cjtaylor

Programmer
Aug 12, 2001
69
US
What is the best way to sum the values of a paradox column? Can you use and sql statement in a query? If so what might the syntax be? Right now I am just iterating through each record to sum them, I thought there might be a better way.

Thanks
Chris taylor
 
Hello

If you want to use SQL you must use a TQuery instead of TTable ;-)

Set the DatabaseName property of the TQuery to point to the folder where the table is.

For the SQL code:
select sum(STable."Field1") from STable


STable is the TableName.

Then doubleclick the TQuery, and add the field 'SUM OF Field1'

Then you can just read the amount

Query1->Active = true;
Edit1->Text=FloatToStrF(Query1SUMOFField1->AsFloat, ffNumber, 10, 2);
Query1->Active = false;

That should do it.



 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top