title: Error related to only_full_group_by when executing a query in MySql
body: <p>I have upgraded my system and have installed MySql 5.7.9 with php for a web application I am working on. I have a query that is dynamically created, and when run in older versions of MySQL it works fine.  Since upgrading to 5.7 I get this error:</p>
  <blockquote>
  <p>Expression #1 of SELECT list is not in GROUP BY clause and contains
  nonaggregated column 'support_desk.mod_users_groups.group_id' which is
  not functionally dependent on columns in GROUP BY clause; this is
  incompatible with sql_mode=only_full_group_by</p>
  </blockquote>
  <p>Note the manual page for Mysql 5.7 on the topic of <a href="http://dev.mysql.com/doc/refman/5.7/en/sql-mode.html" rel="nofollow noreferrer">Server SQL Modes</a>.</p>
  <p>This is the query that is giving me trouble:</p>
  <pre class="lang-sql prettyprint-override"><code>SELECT mod_users_groups.group_id AS 'value', 
         group_name AS 'text' 
  FROM mod_users_groups
  LEFT JOIN mod_users_data ON mod_users_groups.group_id = mod_users_data.group_id 
  WHERE  mod_users_groups.active = 1 
    AND mod_users_groups.department_id = 1 
    AND mod_users_groups.manage_work_orders = 1 
    AND group_name != 'root' 
    AND group_name != 'superuser' 
  GROUP BY group_name 
  HAVING COUNT(`user_id`) &gt; 0 
  ORDER BY group_name
  </code></pre>
  <p>I don't understand <code>only_full_group_by</code> enough to figure out what I need to do to fix the query. Can I just turn off the <code>only_full_group_by</code> option, or is there something else I need to do?</p>