当前位置:网站首页>MySQL报错“Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggre”解决方法
MySQL报错“Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggre”解决方法
2022-07-03 09:25:00 【暮晓引流软件】
解决MySQL5.7版本之后使用GROUP BY语句时报错
今天使用mysql简单的一句分组查询语句(GROUP BY)报错了。
mysql> SELECT * FROM tb GROUP BY empid;
ERROR 1055 (42000): Expression #2 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'db1.tb.sales' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by

查了问题原因和解决方法,成功解决。
问题原因
原因:使用GROUP BY 语句违背了sql_mode=only_full_group_by。因为mysql版本5.7之后默认的模式是ONLY_FULL_GROUP_BY。官网文档的原话:
边栏推荐
- 20220610 other: Task Scheduler
- The underlying principle of vector
- openCV+dlib实现给蒙娜丽莎换脸
- Leetcode - 5 longest palindrome substring
- 2.1 Dynamic programming and case study: Jack‘s car rental
- Mise en œuvre d'OpenCV + dlib pour changer le visage de Mona Lisa
- Boston house price forecast (tensorflow2.9 practice)
- Matplotlib drawing
- Policy gradient Method of Deep Reinforcement learning (Part One)
- 2018 y7000 upgrade hard disk + migrate and upgrade black apple
猜你喜欢

波士顿房价预测(TensorFlow2.9实践)

Hands on deep learning pytorch version exercise solution - 2.4 calculus

Leetcode - 1670 design front, middle and rear queues (Design - two double ended queues)

Opencv feature extraction sift

Raspberry pie 4B installs yolov5 to achieve real-time target detection

Configure opencv in QT Creator

Deep Reinforcement learning with PyTorch
![[C question set] of Ⅵ](/img/49/eb31cd26f7efbc4d57f17dc1321092.jpg)
[C question set] of Ⅵ

LeetCode - 5 最长回文子串

Judging the connectivity of undirected graphs by the method of similar Union and set search
随机推荐
Policy Gradient Methods of Deep Reinforcement Learning (Part Two)
20220608其他:逆波兰表达式求值
CV learning notes - clustering
Hands on deep learning pytorch version exercise solution-3.3 simple implementation of linear regression
Label Semantic Aware Pre-training for Few-shot Text Classification
2018 Lenovo y7000 black apple external display scheme
2312. Selling wood blocks | things about the interviewer and crazy Zhang San (leetcode, with mind map + all solutions)
Mise en œuvre d'OpenCV + dlib pour changer le visage de Mona Lisa
Leetcode - 1172 plate stack (Design - list + small top pile + stack))
Leetcode interview question 17.20 Continuous median (large top pile + small top pile)
Data preprocessing - Data Mining 1
20220610其他:任务调度器
Flutter 退出当前操作二次确认怎么做才更优雅?
LeetCode - 715. Range module (TreeSet)*****
Basic use and actual combat sharing of crash tool
High imitation bosom friend manke comic app
实战篇:Oracle 数据库标准版(SE)转换为企业版(EE)
[LZY learning notes -dive into deep learning] math preparation 2.5-2.7
GAOFAN Weibo app
LeetCode - 703 数据流中的第 K 大元素(设计 - 优先队列)