I have 9 items in a problem_categories tables that have category_id = 1
When I do this query:
select problems.problem_id , problem_title , sum( vote ) as totalVotes
from problems
left join problem_votes on problems.problem_id = problem_votes.problem_id
left join problem_categories on problems.problem_id = problem_categories.problem_id
where problem_categories.category_id = 1;
I get 1 row with a complete sum of all the votes for the 9 items. But what I was really looking for was the 9 rows with a vote sum for each. Any idea what is wrong with my query just by looking at it?
My tables are
problem - lists problem information
problem_votes - has a record per vote for each problem
problem_categories - table keeping a problem_id and a category_id so that a problem can be in a certain category
Thanks, Alex