I can't seem to create the correct query. I have 2 tables and I need to return results from both. Here is the basic structure:
Code:
vbc_challenges
challengeid catid votes score
Code:
vbc_categories
categoryid cat scale entrants
These are the relevant fields. I am trying to return the highest score, highest votes, scale, entrants and cat for each categoryid. categoryid and catid are associated with each other. Basically I thought this query would work:
SELECT cat, scale, entrants, MAX(score) AS highest, SUM(score) AS total, AVG(score) AS average
FROM vbc_categories, vbc_challenges
WHERE categoryid = catid
GROUP BY categoryid
It doesnt work like I thought it would. Am I missing something?