当前位置:网站首页>“Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggregated
“Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggregated
2022-04-23 07:22:00 【qq_ fifteen million one hundred and ninety-seven thousand four 】
Problem description
sql:
SELECT ID ,COUNT(ID) as favoriteCount,productID FROM l_favorite GROUP BY productID
Report errors :
MySql.Data.MySqlClient.MySqlException:“Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggregated column ‘lec.l_favorite.ID’ which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by”
Cause analysis :
It felt strange at first , Run in the database management tool without error ,EF You'll report a mistake again . And there are times mistakes , Sometimes they don't report .
First, I directly searched the error content , Then a bunch of articles are written directly , Get rid of mysql In the configuration file sql_mode=ONLY_FULL_GROUP_BY To configure .
It's very speechless , Don't say the reason for the error , It doesn't solve the problem , Directly solve the configuration items that generate errors , Since the default configuration is like this , That must make sense , Don't change the configuration easily , It's not a good habit .
Then translated this paragraph in English , Probably means to say ID This field has no aggregation .
Well, … Looked at the sql, I'm careless , many select There's a ID Field , And the grouping field is productID . Cause the database to think , Put several different ID Aggregate into one ID, It's illegal .
Solution :
hold select There is no aggregation behind ID Just remove the field .
版权声明
本文为[qq_ fifteen million one hundred and ninety-seven thousand four ]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204230609264857.html
边栏推荐
- .net加载字体时遇到 Failed to decode downloaded font:
- 1.1 PyTorch和神经网络
- Migrating your native/mobile application to Unified Plan/WebRTC 1.0 API
- [recommendation of new books in 2021] practical IOT hacking
- Data class of kotlin journey
- WebRTC ICE candidate里面的raddr和rport表示什么?
- Five methods are used to obtain the parameters and calculation of torch network model
- [2021 book recommendation] practical node red programming
- 第5 章 机器学习基础
- Chapter 1 numpy Foundation
猜你喜欢
【點雲系列】SG-GAN: Adversarial Self-Attention GCN for Point Cloud Topological Parts Generation
ThreadLocal, just look at me!
【点云系列】Multi-view Neural Human Rendering (NHR)
[2021 book recommendation] effortless app development with Oracle visual builder
【点云系列】Pointfilter: Point Cloud Filtering via Encoder-Decoder Modeling
WebView displays a blank due to a certificate problem
Infrared sensor control switch
Component learning (2) arouter principle learning
【点云系列】Learning Representations and Generative Models for 3D pointclouds
c语言编写一个猜数字游戏编写
随机推荐
【动态规划】杨辉三角
Raspberry Pie: two color LED lamp experiment
PyTorch 21. PyTorch中nn.Embedding模块
PyTorch 13. 嵌套函数和闭包(狗头)
Visual studio 2019 installation and use
【3D形状重建系列】Implicit Functions in Feature Space for 3D Shape Reconstruction and Completion
MySQL的安装与配置——详细教程
【点云系列】Neural Opacity Point Cloud(NOPC)
Android exposed components - ignored component security
Five methods are used to obtain the parameters and calculation of torch network model
PyTorch中的一些常见数据类型转换方法,与list和np.ndarray的转换方法
【点云系列】点云隐式表达相关论文概要
[recommendation of new books in 2021] enterprise application development with C 9 and NET 5
给女朋友写个微信双开小工具
Face_ Recognition face detection
Thanos.sh灭霸脚本,轻松随机删除系统一半的文件
第3章 Pytorch神经网络工具箱
机器学习——PCA与LDA
Common regular expressions
【點雲系列】SG-GAN: Adversarial Self-Attention GCN for Point Cloud Topological Parts Generation