处理Mysql数据库工作中遇到关于sql_mode的情况,特学习记录一下 废话不多说直接上错误提示,哈哈哈 bug开始!!!! INSERT INTO mmb_user (openid,mobile,wxmobile,passWord,
废话不多说直接上错误提示,哈哈哈 bug开始!!!!
INSERT INTO mmb_user (openid,mobile,wxmobile,passWord,age,realnm,nicknm,avatar,height,weight,sex,country,province,city,invdcd,uNIOnid,create_date,valid) VALUES (?,?, ?,?, ?, ?,?,?,?,?,?,?, ?,?, ?, ?, now(), "1" ) on duplicate key update nicknm = ?, openid = ?,avatar = ?, update_date = now(),valid = "1"
### Cause: java.sql.SQLSyntaxErrorException: In aggregated query without GROUP BY, expression #1 of SELECT list contains nonaggregated column "ygdb.mmb.id"; this is incompatible with sql_mode=only_full_group_by
; bad SQL grammar []; nested exception is java.sql.SQLSyntaxErrorException: In aggregated query without GROUP BY, expression #1 of SELECT list contains nonaggregated column "ygdb.mmb.id"; this is incompatible with sql_mode=only_full_group_by
In aggregated query without GROUP BY, expression #1 of SELECT list contains nonaggregated column "ygdb.mmb.id"; this is incompatible with sql_mode=only_full_group_by
In aggregated query without GROUP BY, expression #1 of SELECT list contains nonaggregated column "ygdb.mmb.id"; this is incompatible with sql_mode=only_full_group_by
在没有分组依据的聚合查询中,选择列表的表达式#1包含未聚合的列“ygdb.mmb.id”;这与sqlu mode=onlyu fullu groupu by不兼容
意思就我的mysql语法校验规则不合规
那我就在mysql中执行,查看一下,确实有ONLY_FULL_GROUP_BY
①命令:select @@GLOBAL.sql_mode或者select @@SESSION.sql_mode
②命令:SET sql_mode=(SELECT REPLACE(@@sql_mode,"ONLY_FULL_GROUP_BY",""));
③命令:select version(), @@sql_mode;
完事!!!
下面还有惊喜哦,哈哈哈哈哈哈
在表里是没有问题了,但是在存储过程里面是对sql_mode无效的哦!!!需要在过程里面在加入这么一句就支持存储过程了,太棒了。bug修复完成!!!!
SET sql_mode=(SELECT REPLACE(@@sql_mode,"ONLY_FULL_GROUP_BY",""));
对你有帮助给个赞,哈哈哈哈哈哈哈,扫红包在送你个吃饭的券券
--结束END--
本文标题: sql_mode详解,bug修复!!!!!
本文链接: https://www.lsjlt.com/news/8935.html(转载时请注明来源链接)
有问题或投稿请发送至: 邮箱/279061341@qq.com QQ/279061341
下载Word文档到电脑,方便收藏和打印~
2024-05-16
2024-05-16
2024-05-16
2024-05-15
2024-05-15
2024-05-15
2024-05-15
2024-05-15
2024-05-15
2024-05-15
回答
回答
回答
回答
回答
回答
回答
回答
回答
回答
0