当前位置:网站首页>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。官网文档的原话:
边栏推荐
- Opencv interview guide
- 2312. Selling wood blocks | things about the interviewer and crazy Zhang San (leetcode, with mind map + all solutions)
- QT creator uses OpenCV Pro add
- Handwritten digit recognition: CNN alexnet
- CV learning notes - deep learning
- Leetcode - 1670 design front, middle and rear queues (Design - two double ended queues)
- Leetcode-112:路径总和
- Yolov5 creates and trains its own data set to realize mask wearing detection
- Leetcode-106: construct a binary tree according to the sequence of middle and later traversal
- Numpy Foundation
猜你喜欢

Opencv+dlib to change the face of Mona Lisa

LeetCode - 900. RLE 迭代器

Leetcode-513:找树的左下角值

Standard library header file
![[LZY learning notes -dive into deep learning] math preparation 2.5-2.7](/img/57/579357f1a07dbe179f355c4a80ae27.jpg)
[LZY learning notes -dive into deep learning] math preparation 2.5-2.7

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

Advantageous distinctive domain adaptation reading notes (detailed)

CV learning notes - feature extraction

Hands on deep learning pytorch version exercise solution - 2.3 linear algebra
![[C question set] of Ⅵ](/img/49/eb31cd26f7efbc4d57f17dc1321092.jpg)
[C question set] of Ⅵ
随机推荐
Leetcode-513:找树的左下角值
CV learning notes - Stereo Vision (point cloud model, spin image, 3D reconstruction)
LeetCode - 900. RLE iterator
20220604 Mathematics: square root of X
20220606 Mathematics: fraction to decimal
2.1 Dynamic programming and case study: Jack‘s car rental
Model evaluation and selection
Powshell's set location: unable to find a solution to the problem of accepting actual parameters
The underlying principle of vector
20220609 other: most elements
SQL Server Management Studio cannot be opened
. DLL and Differences between lib files
Opencv gray histogram, histogram specification
Leetcode - 895 maximum frequency stack (Design - hash table + priority queue hash table + stack)*
20220605 Mathematics: divide two numbers
20220608其他:逆波兰表达式求值
Step 1: teach you to trace the IP address of [phishing email]
CV learning notes - reasoning and training
20220610 other: Task Scheduler
Hands on deep learning pytorch version exercise solution - 2.5 automatic differentiation