当前位置:网站首页>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。官网文档的原话:
边栏推荐
- Advantageous distinctive domain adaptation reading notes (detailed)
- [LZY learning notes dive into deep learning] 3.1-3.3 principle and implementation of linear regression
- High imitation Netease cloud music
- 20220604数学:x的平方根
- Secure in mysql8.0 under Windows_ file_ Priv is null solution
- Powshell's set location: unable to find a solution to the problem of accepting actual parameters
- CV learning notes - image filter
- CV learning notes - feature extraction
- 20220607其他:两整数之和
- Leetcode - 460 LFU cache (Design - hash table + bidirectional linked hash table + balanced binary tree (TreeSet))*
猜你喜欢
Opencv feature extraction - hog
Leetcode - 460 LFU cache (Design - hash table + bidirectional linked hash table + balanced binary tree (TreeSet))*
Standard library header file
Opencv gray histogram, histogram specification
CV learning notes - feature extraction
2018 y7000 upgrade hard disk + migrate and upgrade black apple
【SQL】一篇带你掌握SQL数据库的查询与修改相关操作
Leetcode-513: find the lower left corner value of the tree
Matplotlib drawing
CV learning notes - BP neural network training example (including detailed calculation process and formula derivation)
随机推荐
LeetCode - 703 数据流中的第 K 大元素(设计 - 优先队列)
1. Finite Markov Decision Process
LeetCode - 673. Number of longest increasing subsequences
Training effects of different data sets (yolov5)
CV learning notes - BP neural network training example (including detailed calculation process and formula derivation)
3.3 Monte Carlo Methods: case study: Blackjack of Policy Improvement of on- & off-policy Evaluation
Leetcode - 5 longest palindrome substring
Hands on deep learning pytorch version exercise solution-3.3 simple implementation of linear regression
Leetcode - 1670 conception de la file d'attente avant, moyenne et arrière (conception - deux files d'attente à double extrémité)
[C question set] of Ⅵ
4.1 Temporal Differential of one step
[LZY learning notes -dive into deep learning] math preparation 2.5-2.7
20220603数学:Pow(x,n)
『快速入门electron』之实现窗口拖拽
CV learning notes - Stereo Vision (point cloud model, spin image, 3D reconstruction)
A complete mall system
R language classification
What useful materials have I learned from when installing QT
Hands on deep learning pytorch version exercise solution - 2.6 probability
SQL Server Management Studio cannot be opened