執行sql語句報錯:
ERROR 1055 (42000): Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'test.fruits.f_id' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by
(錯誤1055(42000):選擇列表的表達式1不在GROUP BY子句中,並且包含未聚合的列“test.fruits.f_id”,它在功能上不依賴GROUP BY子句中的列;這與SQL_mode=only_full_group_by不兼容)
解決辦法:
在mysql中輸入
mysql> set sql_mode ='STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION';
再次從新查詢就OK了!