title: Sum one table where columns match another table and join the results
body: <p>I have been trying to figure this out for a while now and decided I'm not going to figure it out any time soon! Thanks for the help in advance. Love this place.</p>
  
  <p>I have 2 tables</p>
  
  <p><strong>date:</strong></p>
  
  <pre><code>date_id, user_id, cost, title, description
  </code></pre>
  
  <p><strong>date_rating:</strong></p>
  
  <pre><code>date_id, user_id, rating
  </code></pre>
  
  <p>I have multiple entries with the same <code>date_id</code> but different <code>user_id</code>'s. In other words multiple ratings of the same date. The ratings are either 1 or -1. I want to add all the ratings together with the same <code>date_id</code> and then join that to my <code>DATE</code> table where <code>date_id</code> matches. So that I have a column called rating on the table <code>DATE</code>. This way I can sort by rating. Sounds easy but it has proven to be not so easy. I guess DBA is not my thing!</p>
  
  <p>edit: MySQL client version: mysqlnd 5.0.8-dev - 20102224 - $Revision: 310735 $</p>