记录:mysql中关于group by报错
来源:互联网 发布:淘宝直播能在电脑看吗 编辑:程序博客网 时间:2024/05/16 23:56
[Err] 1055 - Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'gsms.shield_infomaction.shield_Id' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by
我安装的是最新版的mysql5.7.x版本,默认是开启了 only_full_group_by
模式的,从而导致GROUP BY 语句报错。
可以参考官方文档:https://dev.mysql.com/doc/refman/5.7/en/group-by-handling.html //GROUP BY
https://dev.mysql.com/doc/refman/5.7/en/sql-mode.html#sqlmode_only_full_group_by //sql_mode
https://dev.mysql.com/doc/refman/5.7/en/miscellaneous-functions.html#function_any-value //any-value
第一想法就是怎么关闭这个模式,但这个模式是默认开启的,如果关闭模式会不会有其它影响,我在网上查到有个函数可以解决这个问题。
在 mysql
中有一个函数: any_value(field)
允许,非分组字段的出现(和关闭 only_full_group_by
模式有相同效果)。
有这个函数就可以解决我的问题了,only_full_group_by
模式是否默认开启在于你们怎么使用。
还有其它解决方法,请参考:http://blog.csdn.net/wangyunfeis/article/details/77911704
sql_mode的几种模式我还需要去了解下的。
- 记录:mysql中关于group by报错
- mysql 查询group by 报错
- 关于Mysql中 GROUP BY 语法!
- mysql中group by
- MySQL中Max+Group BY查询最大值记录无效
- 关于Oracle报错ORA-00979不是GROUP BY表达式
- Mysql报错注入原理分析(count()、rand()、group by)
- Mysql报错注入原理分析(count()、rand()、group by)
- Mysql报错注入原理分析(count()、rand()、group by)
- mssql与mysql中关于group by的区别
- 关于mysql中 group by , order by , where, having 语句的区别与运用
- mysql-关于group by和distinct
- mysql中:单表distinct、多表group by查询去除重复记录
- 解析mysql中:单表distinct、多表group by查询去除重复记录
- mysql中GROUP BY分组取前N条记录实现
- MySQL中group by max如何提取最大的一条记录
- 【转】解析mysql中:单表distinct、多表group by查询去除重复记录
- MySQL5.7 group by,报错1055
- 一、SQL Server数据库大型应用解决方案总结
- 求帮忙
- js 搜索
- 警报协议
- cantnot find the declaration of element 'LinearLayout'报错和android studio项目没有sdk
- 记录:mysql中关于group by报错
- ITIL事件管理流程关键知识
- SQL常用函数
- linux下流量统计脚本
- Java进阶之jsp指令与动作
- Spark DataFrame 操作命令
- tp5的事物使用
- 企业需要PMO部门吗
- oracle中通过DBMS_CRYPTO包对表敏感字段进行加密