You can use COUNT(*) with a GROUP BY to count them number of records
accourding to your grouping.
You will have to use SUM(fieldname) as (sumname) to add values of a
field together of the selected records.
Open Help and type SELECT and the choose SELECT statement for examples.
Comment