The fields after normal select can only be fields in group by or aggregate functions, for example:
select a,max(b) from t group by a;
But you will find that sometimes other people’s mysql is written like this,
select a,b,max(c) from t group by a;
Why don’t others report errors? Pay attention to the last sentence of the error messagesql_mode=only_full_group_by sql_mode is used to check the legality of the SQL statement. When configured as only_full_group_by, the select field is either the result of the aggregate function or the result of group by field value in . Therefore, if you want to ensure that the original sql is executed normally, you can modify the configuration of my.cnf. Comment out sql_mode=only_full_group_by and add a # sign in front
Thanks for the invitation. If possible, please post your code. If there is an error, it should be that the field you are querying is not in GROUP BY. For details, it still depends on your sql statement.
The fields after normal select can only be fields in group by or aggregate functions, for example:
But you will find that sometimes other people’s mysql is written like this,
Why don’t others report errors?
Pay attention to the last sentence of the error messagesql_mode=only_full_group_by
sql_mode is used to check the legality of the SQL statement. When configured as only_full_group_by, the select field is either the result of the aggregate function or the result of group by field value in .
Therefore, if you want to ensure that the original sql is executed normally, you can modify the configuration of my.cnf. Comment out sql_mode=only_full_group_by and add a # sign in front
You groupby ymf.u.uid but you didn’t put it in the select field?
Post the sql together
When you use group by, the field you want to select must be in group by, except for aggregate queries.
Thanks for the invitation. If possible, please post your code. If there is an error, it should be that the field you are querying is not in GROUP BY. For details, it still depends on your sql statement.