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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

sum a column in dbgrid !

Status
Not open for further replies.

masterDicanio

Programmer
May 14, 2005
18
IR
Hi

my table has a column named [sell_price] i show all the records in dbgrid using adotable and a datasource

i want to show the sum of sell_price column in the bottom of dbgrid using a lable !

i wanted to use fkaggregate field (s a new field for my adotable) and set it's expression to SUM(sell_price) but
it seems it doesnt (i used a dbtext pointed to this new column and it returned nothing)[it would be greate if u tell me is it possible to use aggregate fields in adotable at all]

i dont want to loop in table records(it is the most funny way)

i am sure ! there is way , cause there are some components that adds a footer to dbgrid and shows sum,max ,...
 
You could use a TADOQuery and SUM in the SELECT statement. This would be in addition to your main data extraction. I don't think there's an elegant way of selecting data and summing it in one sql statement but there could be, I don't know it off hand.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top