How do I create a query against a person and total up the expenses for each person`

  • Thread starter Thread starter effendi
  • Start date Start date
E

effendi

I have a table containing persons and another which has personexpense.
I would like to create a query which does a total for expenses for each
person. How can I do this?

Thanks
 
Make a select query with the two tables joined on the person id.

Select View: Totals from the menu

Change group by under the ExpenseCost field to Sum.

In SQL statement that would be something like

SELECT Persons.PersonName, SUM(PersonExpense.Cost) as TotalExpenses
FROM Persons Inner JOIN PersonExpense
ON Persons.PersonID = PersonExpense.PersonID
GROUP BY Persons.PersonName

Insert your field and table names.
 
Back
Top