Mysql 分组条款;这与Codeigniter中的sql\u mode=only\u full\u group\u by不兼容

Mysql 分组条款;这与Codeigniter中的sql\u mode=only\u full\u group\u by不兼容,mysql,codeigniter,group-by,Mysql,Codeigniter,Group By,Codeigniter/MYSQL返回此错误 Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'database.segment.id' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_grou

Codeigniter/MYSQL返回此错误

Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'database.segment.id' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by
我怎样才能解决这个问题?昨天很好

在控制台中,如果在执行查询之前使用SET sql_mode='',则查询工作正常,但Codeigniter返回相同的错误

编辑:已解决

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'

mysql 5.7的sql\u mode=only\u full\u group\u by正在启动。。您的db env现在可以使用此mysql版本,或者您已经更改了sql模式。您可以在此处发布sql查询吗?仅此错误是不够的。简单的方法是更改CI的配置,以按sql模式删除唯一完整的组。真正的解决方案是重写查询以符合sql标准,方法是在GROUPBY列表中包含所有非聚合字段(在MySQL v5.7中,可能会忽略功能相关字段)。在这方面已经有很多问题了。最后我可以更改sql模式集GLOBAL sql模式='严格的转换表,日期中没有零,日期没有零,错误除以零,没有自动创建用户,没有引擎替换'重写查询是最好的主意,但要花很多时间,尤其是在生产环境中使用旧版本时。在您有时间重写查询之前,它可以作为快速修复工具发挥巨大作用。