title: SUM() on all rows of a LEFT JOIN?
body: <p>I've been playing with LEFT JOINs and I'm wondering if it's possible to get the SUM of all the ratings so far from all users in the below query. The below get's me the information on if the logged in user has rated or not, but i want to show total ratings from other users also.</p>
  
  <pre><code>$query = mysql_query("
  SELECT com.comment, com.comment_id, r.rate_up, r.rate_down
  FROM comments com
  LEFT JOIN ratings r
  ON com.comment_id = r.comment_id
  AND r.user_id = '" . $user_id_var . "'
  WHERE page_id = '" . $category_id_var. "'");
  </code></pre>
  
  <p>I've tried the following but i only get one comment/row returned for some reason.</p>
  
  <pre><code>$query = mysql_query("
  SELECT com.comment, com.comment_id,
  r.rate_up, r.rate_down 
  SUM(r.rate_up) AS total_up_ratings, 
  SUM(r.rate_down) AS total_down_ratings,
  FROM comments com
  LEFT JOIN ratings r
  ON com.comment_id = r.comment_id
  AND r.user_id = '" . $user_id_var . "'
  WHERE page_id = '" . $category_id_var. "'");
  </code></pre>
  
  <p>Any help appreciated. Do i need a different kind of JOIN?</p>