SELECT list is not in GROUP BY clause and contains nonaggregated column 'uav.case_board.port' which is not functionally dependent on columns in GROUP BY clause;

 

mysql 5.7以上版本抛出错误,SELECT list is not in GROUP BY clause and contains nonaggregated column 'uav.case_board.port' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by

groug by在5.7以上的版本在ONLY_FULL_GROUP_BY这个模式下,需要每个字段值非空,配置一下mysql

set @@GLOBAL.sql_mode='STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION';
set @@SESSION.sql_mode='STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION';

SELECT @@GLOBAL.sql_mode;
SELECT @@SESSION.sql_mode;

posted @ 2024-04-09 13:09  李悠然  阅读(15)  评论(0)    收藏  举报