The expression of the SELECT list is not in the GROUP BY clause and contains non-aggregated columns, which is incompatible with sql_mode = only_full_group_by

In the exercise, the most expensive product in the query group is reported as an error

ERROR 1055 (42000): Expression #2 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'mugua.goods.goods_name' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by

 Error 1055 (42000): The expression #2 of the select list is not in the GROUP BY clause and contains muga.goods for non-aggregated columns. goods_name', it is not functionally dependent on the columns in the GROUP BY clause; this is not compatible with sql_mode=only_full_group_by

Most methods on the Internet are

Solution:
1. Find the mysql configuration file my.ini (usually in the mysql root directory)

2. Add the following content under [mysqld] in my.ini

sql_mode=STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION

3. Restart the mysql service! problem solved!

But I added my mysql service can not start.

The reason for the error is that the new version of mysql is in strict mode. At this time, you need to change the strict mode to normal mode.

Modify through the configuration file:

Add the following content under [mysqld] in my.ini

sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES

Strict mode mainly uses the following scenarios

  • Does not support inserting null values ​​into not null fields
  • Does not support inserting "values ​​for self-growing fields"
  • Does not support default values ​​for text fields

 

 

Guess you like

Origin blog.csdn.net/tang242424/article/details/106971304