1055 - Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggregated column nr_devwms_sub_use_itemid which is not functionally dependent on columns in GROUP BY clause; this is inco
This error message is caused by the SQL mode "only_full_group_by" being enabled. In this mode, all columns in the SELECT clause that are not part of an aggregate function (such as COUNT, SUM, AVG, etc.) must be included in the GROUP BY clause.
To resolve this issue, you have a few options:
-
Disable the "only_full_group_by" mode: This can be done by modifying the SQL mode in your database configuration file (e.g., my.cnf or my.ini) or by running the following command before executing your query:
SET sql_mode = '';. However, keep in mind that this may have other implications on the behavior of your queries. -
Include the non-aggregated column in the GROUP BY clause: If the non-aggregated column is functionally dependent on the columns in the GROUP BY clause, you can include it in the GROUP BY clause to resolve the error. For example:
SELECT id, other_column FROM wms_sub_use_item GROUP BY id, other_column; -
Use an aggregate function for the non-aggregated column: If the non-aggregated column is not functionally dependent on the columns in the GROUP BY clause, you can use an aggregate function on that column. For example:
SELECT MAX(id) FROM wms_sub_use_item GROUP BY other_column;
Choose the option that best suits your needs and modify your query accordingly to resolve the error.
原文地址: https://www.cveoy.top/t/topic/i84Y 著作权归作者所有。请勿转载和采集!