当前位置:网站首页>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。官网文档的原话:
边栏推荐
- Notes - regular expressions
- 20220609其他:多数元素
- Configure opencv in QT Creator
- Handwritten digit recognition: CNN alexnet
- The underlying principle of vector
- Realize an online examination system from zero
- 20220608其他:逆波兰表达式求值
- [LZY learning notes dive into deep learning] 3.5 image classification dataset fashion MNIST
- Opencv image rotation
- LeetCode - 508. Sum of subtree elements with the most occurrences (traversal of binary tree)
猜你喜欢
Leetcode - 1670 design front, middle and rear queues (Design - two double ended queues)
Opencv feature extraction - hog
Pycharm cannot import custom package
[LZY learning notes -dive into deep learning] math preparation 2.5-2.7
CV learning notes ransca & image similarity comparison hash
Leetcode - the k-th element in 703 data flow (design priority queue)
Leetcode - 706 design hash mapping (Design)*
【C 题集】of Ⅵ
Leetcode - 460 LFU cache (Design - hash table + bidirectional linked hash table + balanced binary tree (TreeSet))*
Leetcode-106:根据中后序遍历序列构造二叉树
随机推荐
LeetCode - 1670 設計前中後隊列(設計 - 兩個雙端隊列)
【C 题集】of Ⅵ
[LZY learning notes dive into deep learning] 3.4 3.6 3.7 softmax principle and Implementation
Neural Network Fundamentals (1)
Leetcode-100: same tree
Hands on deep learning pytorch version exercise solution -- implementation of 3-2 linear regression from scratch
Leetcode 300 longest ascending subsequence
Boston house price forecast (tensorflow2.9 practice)
4.1 Temporal Differential of one step
CV learning notes - deep learning
Policy Gradient Methods of Deep Reinforcement Learning (Part Two)
LeetCode - 508. Sum of subtree elements with the most occurrences (traversal of binary tree)
Leetcode-106:根据中后序遍历序列构造二叉树
Several problems encountered in installing MySQL under MAC system
Leetcode - 1670 design front, middle and rear queues (Design - two double ended queues)
LeetCode - 673. Number of longest increasing subsequences
Opencv feature extraction sift
Leetcode - 705 design hash set (Design)
CV learning notes convolutional neural network
Leetcode-404: sum of left leaves