How to query db and sum the rows returned

Hello,

I have a need to query the DB for all products sold to a client then get the total. This then needs to be displayed in a field.

I am using SugarCRM CE 6.5.13

I would greatly appreciate any assistance.

Thanks.