[乐意黎原创]mysql命令gruop by报错this is incompatible with sql_mode=only_full_group_by

如题: MySQL执行查询时,抛SQL语句执行失败:
SELECT gzh_en, artID, count(*) as count FROM `****` group by `ori_url` having count>1 ORDER BY `id` DESC LIMIT 0,50000

失败原因:Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggregated column '*****' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by

如图: 

[乐意黎原创]mysql命令gruop by报错this is incompatible with sql_mode=only_full_group_by_第1张图片
解决方法:

修改my.ini 配置(my.cnf配置问题)

 

在 [mysqld]和[mysql]下添加:

 

[mysqld]
#
# * Basic Settings
lower_case_table_names=1
character-set-server=utf8
sql_mode=STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION;

 

如图:

[乐意黎原创]mysql命令gruop by报错this is incompatible with sql_mode=only_full_group_by_第2张图片

 

 

乐意黎原创:

 

你可能感兴趣的:([乐意黎原创]mysql命令gruop by报错this is incompatible with sql_mode=only_full_group_by)