The error message you are seeing is related to the SQL mode only_full_group_by. This mode enforces that all columns in the SELECT list must either be part of the GROUP BY clause or be used with an aggregate function like SUM, COUNT, etc.

In your case, you are using an aggregated query without a GROUP BY clause, and the column a.shopTaskId is not being aggregated or included in the GROUP BY clause. To resolve this error, you have a few options:

  1. Include the non-aggregated column in the GROUP BY clause:
SELECT a.shopTaskId, MAX(a.someColumn)
FROM yourTable a
GROUP BY a.shopTaskId;
  1. Use an aggregate function on the non-aggregated column:
SELECT MAX(a.shopTaskId), MAX(a.someColumn)
FROM yourTable a;
  1. Disable the only_full_group_by mode by running the following statement before executing your query:
SET sql_mode = '';

Note that disabling the only_full_group_by mode may have other implications, so use it with caution.

Choose the option that best suits your requirements and adjust your query accordingly


原文地址: https://www.cveoy.top/t/topic/hOS2 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录