当前位置:Gxlcms > 数据库问题 > Mysql 分组查询出现'this is incompatible with sql_mode=only_full_group_by'的解决办法

Mysql 分组查询出现'this is incompatible with sql_mode=only_full_group_by'的解决办法

时间:2021-07-01 10:21:17 帮助过:2人阅读

由于Mysql自动开启了 only_full_group_by,所以若查询的字段不在group by里面,则分组报错。

解决办法其一:mysql配置,关闭only_full_group_by,这种办法自行百度

下面说第二种办法:

除去group_by 以外的参数加上any_value(*) 如:SELECT type_id,any_value(`name`)  FROM ts_product GROUP BY type_id;

Mysql 分组查询出现'this is incompatible with sql_mode=only_full_group_by'的解决办法

标签:参数   val   mysql配置   自动   查询   解决   mysql   报错   only   

人气教程排行