I have a 2 tables: abstracts, judges_points
I have people who submit their papers to be judged by several judges.
The table judges_points hold the individual points for each judge and abstract they judged.
$sql = "
SELECT r.*,
AVG(j.interest) AS int_sum,
AVG(j.methodology) AS meth_sum,
AVG(j.content) AS cont_sum,
AVG(j.interest) + AVG(j.methodology) + AVG(j.content) AS total
FROM abstracts r
INNER JOIN judges_points j
ON r.abstract_id = j.abstract_id
GROUP BY r.abstract_id
ORDER BY total DESC
";
I want to add (AND r.yearJudge = '2006' ) to the query, but when I do, it will only show 2 rows, when there should be many more. I placed it before GROUP BY r.abstract_id.
Is this correct? I'm not used to trying the INNER JOIN statements.