title: How to calculate an average from an nested join Query?
body: <p>I'm trying to query the average of a column named <code>watts</code> from a <code>consumption</code> table for each <code>appliance</code> that each registry is linked to, but I must separate each value on behalf of the <code>proto</code> and <code>user</code> to whom said info belongs. </p>
  
  <p>Therefore I have to join each table that will ultimately link the user to my query. I was able to accomplish the second half of this task. However, when I try to calculate said average using the <code>AVG()</code> function an error shows up in MySQL.</p>
  
  <blockquote>
    <h1>1140 - In aggregated query without GROUP BY, expression #1 of SELECT list contains non-aggregated column moniref.cr.idConsumption'; this is incompatible with sql_mode=only_full_group_by</h1>
  </blockquote>
  
  <p>I've tried this query which actually works in the sense that shows only the user's '1' registries, but can't find a way to properly calculate the average for each appliance.</p>
  
  <pre><code>SELECT
    cr.idConsumption,
    AVG(cr.watts),
    a.idApliance,
    p.idProto
  FROM
    consumptionregistry cr
  INNER JOIN
    apliance a
  ON
    a.idApliance = cr.apliance_idApliance
  INNER JOIN
    proto_has_apliance phs
  ON
    phs.apliance_idApliance = a.idApliance
  INNER JOIN
    proto p
  ON
    phs.Proto_idProto = p.idProto AND p.user_idUser=1
  </code></pre>
  
  <p>I'm expecting to see something like this:
      <img src="https://i.stack.imgur.com/8BMf8.png" alt="Succ Table"></p>