you can turn off the warning message as explained in the other answers or you can understand what’s happening and fix it.
As of MySQL 5.7.5, the default SQL mode includes ONLY_FULL_GROUP_BY which means when you are grouping rows and then selecting something out of that groups, you need to explicitly say which row should that selection be made from.
Mysql needs to know which row in the group you’re looking for, which gives you two options
- You can also add the column you want to the group statement
group by rect.color, rect.valuewhich can be what you want in some cases otherwise would return duplicate results with the same color which you may not want
- you could also use aggregate functions of mysql to indicate which row you are looking for inside the groups like
- AND finally you can use
ANY_VALUE()if you are sure that all the results inside the group are the same. doc