### The error may exist in file [E:\Java_Pro\Project\basic-code\Springboot_Pro\target\classes\mapper\WaterDetailsMapper.xml] ### The error may involve com.lxyk.mapper.WaterDetailsMapper.queryWaterDetails-Inline ### The error occurred while setting parameters ### SQL: SELECT count(0) FROM (SELECT w.worker_name, w.worker_image, IFNULL(GROUP_CONCAT(DISTINCT c.cust_name), "-") AS cust_details, c.cust_address, IFNULL(GROUP_CONCAT(h.send_water_count), 0) AS send_water_count FROM tb_worker w LEFT JOIN tb_history h ON w.wid = h.worker_id LEFT JOIN tb_customer c ON h.cust_id = c.cid GROUP BY w.worker_name) table_count ### Cause: java.sql.SQLSyntaxErrorException: Expression #2 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'water.w.worker_image' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by
时间: 2024-01-24 16:18:33 浏览: 76
CentOS-7-x86_64-DVD-2009.part3.rar
5星 · 资源好评率100%
这个错误是由于在 SQL 查询中使用了 GROUP BY 子句,但是 SELECT 列表中包含了未在 GROUP BY 子句中出现且不是聚合函数的列。这是 MySQL 的一种严格模式,即 sql_mode=only_full_group_by,要求 SELECT 列表中的非聚合列必须出现在 GROUP BY 子句中。你需要修改 SQL 查询,将 SELECT 列表中的非聚合列添加到 GROUP BY 子句中,或者使用聚合函数对这些列进行计算。
阅读全文