title: Sort by AVG(rating)
body: <p>I am trying to write a mySQL-query that sorts by first <strong>suburb</strong> and then <strong>AVG(rating_table.rating)</strong>.</p>
  
  <p>Here is the <strong>street_table</strong>:</p>
  
  <pre><code>id       street_name       suburb
  
  0        streetone         subone
  1        streettwo         subthree
  2        streetthree       subthree
  3        streetfour        subtwo
  </code></pre>
  
  <p>And here is the <strong>rating_table</strong>:</p>
  
  <pre><code>street_id    rating
  
  1            1
  2            1
  3            4
  2            2
  1            3
  </code></pre>
  
  <p>And this is the result I am looking for:</p>
  
  <pre><code>id      suburb         avarage_rating
  
  0       subone         (no rating)
  1       subtwo         1 + 3 / 2 = 2
  3       subthree       4 / 1 = 4 (Just one vote..)
  2       subthree       2 + 1 / 2 = 1.5
  </code></pre>
  
  <p>(As you can see, <strong>#3</strong> is before <strong>#2</strong> because of the <strong>avarage_rating</strong>)</p>