group by column 报错:this is incompatible with sql_mode=only_full_group_by

MySQL5.7.5后only_full_group_by成为sql_mode的默认选项,导致使用group by进行分组查询报错
this is incompatible with sql_mode=only_full_group_by

默认sql_mode: ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION   执行以下两条SQL命令去除ONLY_FULL_GROUP_BY,解决group by报错:
SET GLOBAL sql_mode='STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION';

SET SESSION sql_mode='STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION';

 

上一篇:【荔枝派zero】usb虚拟串口实现


下一篇:golang 日期格式化参数介绍