当前位置:网站首页>[Err] 1055 - Expression#2 of select list is not in GROUP BY clause and contains nonaggregated column
[Err] 1055 - Expression#2 of select list is not in GROUP BY clause and contains nonaggregated column
2022-07-28 08:04:00 【The galloping snail has been occupied】
stay MySQL Use group by Report errors :
select courseid,score,stuid from score group by courseid;
[Err] 1055 - Expression #2 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'ssm.score.stuid'
which is not functionally dependent on columns in GROUP BY clause;
this is incompatible with sql_mode=only_full_group_by
select The field of appears group by Fields that do not appear in , So wrong reporting ; stay sql_mode=only_full_group_by when , The following expressions are allowed :
select a,b [ Aggregate functions (c)] from table_name group by a,b
In this column :group by Yes 2 A field :a, b; therefore select Legal writing of fields :
select a [ Aggregate functions (c)] /select b [ Aggregate functions (c)] /select a,b [ Aggregate functions (c)]
If you want to select Fields are not subject to group by The field limit only needs to be set sql_mode that will do ;
1. Find out sql_mode Value
select @@global.sql_mode;
//ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION
Copy values , Different versions sql_mode The value of may not be the same , Just copy the value according to your own query
2. take ONLY_FULL_GROUP_BY Get rid of , To reset sql_mode Value
set global sql_mode='STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION';
This method is restarting MySQL after , It will still return to the previous mode ; Want permanent effect , You need to use the following method : stay ini Add... To the file :
[mysqld]
sql_mode='STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION'
边栏推荐
- How do we run batch mode in MySQL?
- Solve the inherent defects of CNN! Common CNN architecture ccnn is coming | icml2022
- 【17】建立数据通路(上):指令+运算=CPU
- 滴滴SQL面试题之打车业务问题如何分析
- DNA modified noble metal nanoparticles | DNA deoxyribonucleic acid modified metal palladium Pd nanoparticles pdnps DNA
- Near infrared two region agzs quantum dots wrapped deoxyribonucleic acid dna|dna agzsqds (Qiyue)
- How to close the blocked program process?
- JUC atomic class: CAS, unsafe, CAS shortcomings, how to solve ABA problems in detail
- Will ordinary browsers disclose information? How to protect privacy by using a secure browser?
- XSS knowledge points and 20 character short domain name bypass
猜你喜欢

What is the root cause of EMC's problems?

Google and Stanford jointly issued a document: why do we have to use large models?

Qt使用信号量控制线程(QSemaphore)

Opencv's practical learning of credit card recognition (4)

Information system project manager must recite the core examination site (41) risk management plan

CLion调试redis6源码

EMC设计攻略 —时钟

Lecture notes a utility for everyone to generate PCG

DNA-Ag2SQDs脱氧核糖核酸DNA修饰硫化银Ag2S量子点的合成方法

【活动报名】云原生技术交流 Meetup,8 月 6 日广州见
随机推荐
EMC's "don't come back until you rectify"
记录一次mycat连接Communications link failure问题解决
Tensorflow uses deep learning (II)
Oracle local network service
Mysql中有哪些不同的表格?
XSS knowledge points and 20 character short domain name bypass
[300 + selected interview questions from big companies continued to share] big data operation and maintenance sharp knife interview question column (VIII)
EMC design strategy - clock
Near infrared two region agzs quantum dots wrapped deoxyribonucleic acid dna|dna agzsqds (Qiyue)
Record a MYCAT connection and solve the problems of communications link failure
0727~ sorting out interview questions
解析树形结构 js
使用FFmpeg来批量生成单图+单音频的一图流视频
QT uses semaphores to control threads (qsemaphore)
Introduction to magnetic ring selection and EMC rectification skills
Fxksmdb.exe process description
And is two numbers of S - two questions per day
What if the computer file cannot be deleted?
DNA修饰金属铑Rh纳米颗粒RhNPS-DNA(DNA修饰贵金属纳米颗粒)
Disassemble Huawei switches and learn Basic EMC operations