dispositiontools / craft-commerceinsights

Get insights from Craft Commerce
Other
1 stars 1 forks source link

MySQL only_full_group_by error on getCustomers #2

Closed WHITE-developer closed 2 years ago

WHITE-developer commented 2 years ago

Hi,

We get this message on the getCustomers method in the CustomersService. Looks like this query is made pre MySQL 5.7.5 due to the 'only_full_group_by' error.

Syntax error or access violation: 1055 Expression #15 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'craft.co.email' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by

Tested it locally and made this change to make it work on line 126 of src/services/Customers.php

->groupBy(['co.customerId'])

to

->groupBy(['co.customerId', 'co.email'])

If this is fixed that we can start using it in our production enviroments on MySQL 8. Thanks

dispositiontools commented 2 years ago

Thank you very much for this. I'm currently working on some refactoring and improvements over multi sites and differences between variants. A fix has now been pushed.