So I have 2 tables:
So I call the list of 'transactions' with SELECT * FROM transactions WHERE t_user = 'userid'.
This could load say 100 transactions.
There are 500 records in 'categories'.
The list of transactions could be across say 25 categories (therefore being multiple transactions for each category).
For each category applicable I want to calculate the total amount in value from t_amount.
What is the best way to do this?
The only thing I can think of is to load all the 'categories' then perform a loop for each category to get all transactions with that category ID and adding the value.
But this seems like it could be a very long process going through all the categories for just the few the user is using.........