title: SELECT list is not in GROUP BY clause and contains nonaggregated column … incompatible with sql_mode=only_full_group_by
body: <p>I have data that looks like this in
  RESOURCE TABLE</p>
  
  <pre><code>id  name  weight  key
  1   res1   12    1
  2   res2   12    1
  3   res3   13    2
  4   res4   13    2
  </code></pre>
  
  <p>I have the following query</p>
  
  <pre><code>SELECT
  resource.id,
  resource.name,
  resource.weight,
  
  from resource join 
  inventory on resource.weight = inventory.weight
  where inventory.key = ?
  GROUP BY resource.weight;
  </code></pre>
  
  <p>I would like to get this data, I would like group by weight so I only have all unique weight values</p>
  
  <pre><code>id  name  weight  key
  1   res1   12    1
  4   res4   13    2
  </code></pre>
  
  <p>I'm getting this error however</p>
  
  <pre><code>Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'RESOURCE.id' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by
  </code></pre>
  
  <p>So when I add the id to the Group by </p>
  
  <pre><code>GROUP BY resource.value, resource.name, resource.id;
  </code></pre>
  
  <p>It works but now I no longer get the unique weight values, it adds all the rows.</p>
  
  <p>How can I achieve this without turning off sql_mode=only_full_group by?</p>