ELECT 農家名, SUM(金額) FROM article7 WHERE 日時 BETWEEN ‘2022-01-11’ AND ‘2022-01-25’ GROUP BY 農家名, 組勘番号 ORDER BY 組勘番号;
どうも ORDER BYを使うときに GROUP BYのところにも 入れなきゃだめみたいだ
SELECT 農家名, SUM(金額) FROM article7 WHERE 日時 BETWEEN ‘2022-01-11’ AND ‘2022-01-25’ GROUP BY 農家名 ORDER BY 組勘番号;
ERROR 1055 (42000): Expression #1 of ORDER BY clause is not in GROUP BY clause and contains nonaggregated column ‘media.article7.組勘番号’ which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by
となる