I am upgrading some old SS 2.4 code to SS4. I am getting the following error when executing the below query:
Error:
Expression #1 of
SELECT
list is not inGROUP BY
clause and contains non-aggregated column't.Total'
which is not functionally dependent on columns inGROUP BY
clause;
this is incompatible withsql_mode=only_full_group_by
.
How can I update this query to be compatible with mysql strict mode? Editing my.cnf mysql_mode doesn't seem to take effect
SELECT SalesRepRegion,COUNT(DISTINCT(SalesRepID)) as Total FROM Sale s
WHERE SalesRepRegion <> 'NULL' AND YEARWEEK( SalesDate, 1 ) = ".$yearweek." AND Status <> 'Void'
GROUP BY SalesRepRegion