mysql查询语句group by 语句报错

高版本的mysql 在查询语句时 有group by 会报错 报错信息如下

> 1055 - Expression #40 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'dsjpt.sys_fl_task.node_name' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by

解决方法,打开navicat 按f6 调出命令行
按一下代码一次执行 执行完之后就可以了


select @@global.sql_mode;

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';
 

猜你喜欢

转载自blog.csdn.net/weixin_65846839/article/details/132046230