title: Error related to sql mode=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:
  So this is the code that is giving me errors:</p>
  
  <pre><code>select *,SUM(payment) as payment,DATE_FORMAT(payment_date,'%b') as month 
  from payment 
  natural join branch
  where YEAR(payment_date)='$year' and MONTH(payment_date)='$month' 
  group by branch_id,MONTH(payment_date) 
  order by  MONTH(payment_date)
  </code></pre>
  
  <p>I did some googling on the issue, but I don't understand only_full_group_by enough to figure out what I need to do to fix the query. Can I just turn off the only_full_group_by option, or is there something else I need to do?</p>
  
  <p>Let me know if you need more information.</p>