I've asked the mods to move this as it's a Database question.

And the others are right... what you need to do is join the two tables together... depending on the results you want, it can be either an inner join - which give you only the rows that exist in both tables - or a left join - which would give you all the rows in the left table, plus any that match in the right table.


so, something like this:
Code:
select c.c_id, sum(t.t_amount) as Total
from categories c
inner join transaction t on c_id = t_cat
group by c.c_id

How ever, I STRONGLY suggest you pick another table name for your Transaction table, as Transaction really is a reserved word and can cause problems for you later....


-tg