Add values with conditionals

I have a table with financial information on paid and pending bills and another with customer records. I need to enter the sum of the outstanding amount and the sum of the outstanding amount in the customer’s record, as well as the number of records for each one. Is there a way to do this?