当前位置:网站首页>sql_ mode=only_ full_ group_ By's pit
sql_ mode=only_ full_ group_ By's pit
2022-06-25 04:20:00 【Robin Luo Bing】
One 、 Translate a paragraph , English is not good , Forgive me
Syntax error or access violation: 1055 Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'a16.a.id' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by
Syntax: grammar .violation: It is illegal to .Expression: expression . clause: clause .contains: contain .nonaggregated: Non aggregation .functionally: Functionality .dependent: rely on .incompatible: Are not compatible
Two 、only_full_group_by:
1、 This rule requires : Where there are group by The fields that appear later , Must be at the same time select Behind the ; Where there are select Later on 、 Fields that do not appear in the aggregate function at the same time , Must appear at the same time group by Back ”, Check sql Compliance with the above rules .
2、order by The following columns must be in select There is something behind it
3、select、having or order by The following non aggregate columns must all be in group by in
https://zhuanlan.zhihu.com/p/103283746
3、 ... and 、 Aggregate functions ( Combinatorial function ): Aggregate functions aggregation function Also called group function . By default The aggregate function will count the current table as a group .https://www.cnblogs.com/xuchuankun/p/9483765.html
Four 、GROUP BY sentence :GROUP BY Statements are used to combine aggregate functions , Group result sets according to one or more columns .
5、 ... and 、group by Detailed explanation :https://blog.csdn.net/jerrytomcat/article/details/82351605
https://blog.csdn.net/s00229295/article/details/96041555
6、 ... and 、Having And Where The difference between
where Clause is used before grouping query results , Will not meet where The line of the condition is removed , Filtering data before grouping ,where A condition cannot contain a grouper function , Use where Conditions filter out specific lines .
having Clause is used to filter groups that meet the conditions , Filtering data after grouping , Conditions often include groupings , Use having Conditions filter out specific groups , You can also use multiple grouping criteria for grouping .
7、 ... and 、MYSQL in GROUP BY Do not include all non aggregated fields :https://blog.csdn.net/liufei198613/article/details/82979034
8、 ... and 、 Multi table queries do not seem to follow the above rules : The following code does not report an error , What's the reason ?
$map['a.user_id'] = $this->auth->id;
$map['b.type'] = 1;
$map['b.deletetime'] = null;
$map['b.endtime'] = ['>', time()];
$map['b.starttime'] = ['<', time()];
$field = 'a.id, a.plan_id, b.plan_name, b.times, b.hours, b.endtime, b.starttime,b.type,b.exam_id,c.exam_name, max(d.lasttime) as lasttime';
$plans = $this->model
->alias('a')
->where($map)
->field($field)
->join('__KAOSHI_PLAN__ b', 'a.plan_id = b.id')
->join('__KAOSHI_EXAMS__ c', 'b.exam_id = c.id')
->join('__KAOSHI_USER_EXAMS__ d', 'a.id = d.user_plan_id', 'left')
->group('a.id, b.id')
->select();
边栏推荐
- Nodejs 通过Heidisql连接mysql出现ER_BAD_DB_ERROR: Unknown database 'my_db_books'
- UCLA | 用于黑盒优化的生成式预训练
- "Renaissance" in the digital age? The bottom digital collection makes people happy and sad
- 5 key indicators of SEO: ranking + traffic + session + length of stay + bounce rate
- MySQL order by
- Hot and cold, sweet and sour, want to achieve success? Dengkang oral, the parent company of lengsuanling, intends to be listed on the main board of Shenzhen Stock Exchange
- Mathematical analysis_ Notes_ Chapter 3: limits
- 数学分析_笔记_第3章:极限
- 2.吹响半音阶口琴
- acmStreamOpen返回值问题
猜你喜欢

Development of trading system (II) -- market data
![L'épée leetcode fait référence au chemin leetcode de l'offre II 091 pour peindre la maison [planification dynamique] heroding](/img/ad/69fce7cf064479a0ddd477fb935de2.png)
L'épée leetcode fait référence au chemin leetcode de l'offre II 091 pour peindre la maison [planification dynamique] heroding

How to install opencv? Opencv download installation tutorial

警惕超范围采集隐私-移动APP违规十宗罪

How much do you know about the use value of WMS warehouse management system

"Grammar sugar" -- my new programming knowledge

How to quickly deliver high-value software

"Comment positionner l'industrie" dans la planification industrielle locale / parc

DAP data scheduling function improvement description

冷热酸甜、想成就成?冷酸灵母公司登康口腔欲在深交所主板上市
随机推荐
Development of trading system (VI) -- HFT high frequency trading
How to quickly deliver high-value software
NFT insider 63: the sandbox reached a cooperation with Time magazine, and YGG established Spain's subdao
Win10 environment phpstudy2016 startup failure record
Coinlist queuing tutorial to improve the winning rate
navicat可不可以直接操作安卓数据库SQLite
A-table mouse over the display hand, the current line can be clicked
Development of trading system (IX) -- dark pool technology
Summary of various problems encountered by cocos2d-x
2.吹响半音阶口琴
Trading system development (IV) - trading counter system
How to install opencv? Opencv download installation tutorial
【openwrt】推荐一个国内开发的openwrt的版本,iStoreOS简介,非常好用,主要是做了一些优化。解决了汉化的问题。
[openwrt] we recommend a domestically developed version of openwrt, an introduction to istoreos. It is very easy to use. It is mainly optimized. It solves the problem of Sinicization.
acmStreamOpen返回值问题
Changsha's "talent seeking": "making efforts" and "making practical moves" go hand in hand, "rapid development" and "slow life" go hand in hand
Text keyword extraction: ansj
【LeetCode】148. Sort linked list
Development of trading system (x) -- fix agreement
【Kubernetes系列】Helm的安装使用