title: MySQL: Average and join two queries
body: <p>I have two queries: </p>
  
  <pre><code>SELECT
    s.id AS id,
    g.id AS group_id,
    g.nazwa AS group_name,
    s.nazwa AS station_name,
    s.szerokosc AS szerokosc,
    s.dlugosc AS dlugosc,
    s.95 as p95,
    s.98 as p98,
    s.Diesel as diesel,
    s.DieselTIR as dieseltir,
    s.Super98 as s98,
    s.SuperDiesel as sdiesel,
    s.LPG as lpg,
    s.ulica as ulica,
    s.kodPocztowy as kod_pocztowy,
    s.miasto as miasto,
    w.id as wojewodztwo_id,
    w.nazwa as wojewodzto_nazwa,
    k.id as kraj_id,
    k.kod as kraj_kod,
    k.nazwa as kraj_nazwa,
    s.data as date_mod,
    s.active as active
  FROM stacje_main s
  JOIN stacje_grups g ON (s.grupa=g.id)
  JOIN wojewodztwa w ON (s.wojewodztwo=w.id)
  JOIN kraje k ON  (w.kraj=k.id)
  WHERE s.data &gt; 0;
  </code></pre>
  
  <p>and</p>
  
  <pre><code>SELECT
    AVG(rr.vote) as average,
    COUNT(rr.station_id) counter
  FROM stacje_ratings rr
  GROUP BY rr.station_id;
  </code></pre>
  
  <p>In the second query not all id (station_id) are present, and sometimes are doubled.
  Join station_id with id, and give average value of rate for each id.</p>
  
  <p>The problem that when no rate, the value in question in average and counter have to be 0.</p>
  
  <p>When I combined these queries i see only this ID, that has present station_id.
  But I want to see all.</p>