欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

解决MySQL 5.7.9版本sql_mode=only_full_group_by问题

程序员文章站 2023-02-17 13:14:31
mysql 5.7.9版本sql_mode=only_full_group_by问题 用到group by 语句查询时com.mysql.jdbc.exceptions....

mysql 5.7.9版本sql_mode=only_full_group_by问题

用到group by 语句查询时com.mysql.jdbc.exceptions.jdbc4.mysqlsyntaxerrorexception: expression #2 of select list is not in group by clause and contains nonaggregated column 'col_user_6.a.start_time' which is not functionally dependent on columns in group by clause; this is incompatible with sql_mode=only_full_group_by错误

解决方法 :

执行set global sql_mode = ''; 把sql_mode 改成非only_full_group_by模式。

验证是否生效 select @@global.sql_mode 或 select @@sql_mode

set sql_mode ='strict_trans_tables,no_zero_in_date,no_zero_date,error_for_division_by_zero,no_auto_create_user,no_engi

以上所述是小编给大家介绍的解决mysql 5.7.9版本sql_mode=only_full_group_by问题,希望对大家有所帮助