mysql sql_mode ONLY_FULL_GROUP_BY
sql_mode
mysql> select @@sql_mode; +------------------------------------------------------------------------------------------------------------------------+ | @@sql_mode | +------------------------------------------------------------------------------------------------------------------------+ | STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION | +------------------------------------------------------------------------------------------------------------------------+ 1 row in set (0.00 sec) mysql> select distinct empno from EMP order by deptno ; +-------+ | empno | +-------+ | 1 | | 0 | +-------+ 2 rows in set (0.02 sec) mysql> set sql_mode ='ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION'; Query OK, 0 rows affected (0.01 sec) mysql> select distinct empno from EMP order by deptno ; ERROR 3065 (HY000): Expression #1 of ORDER BY clause is not in SELECT list, references column 'test.EMP.DEPTNO' which is not in SELECT list; this is incompatible with DISTINCT mysql>
5.6之前預設非嚴格的分組函式,5.7開始預設是嚴格的聚合函式,透過ONLY_FULL_GROUP_BY控制
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/29990276/viewspace-2908962/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- MySQL sql_mode=only_full_group_by 錯誤MySql
- mysql 禁用 ONLY_FULL_GROUP_BY,暫時解決錯誤(sql_mode=only_full_group_by)MySql
- MySQL錯誤-this is incompatible with sql_mode=only_full_group_by完美解決方案MySql
- MySQL 之 only_full_group_byMySql
- MySQL 預設 only_full_group_byMySql
- MySQL的sql_mode合理設定MySql
- MySQL 的 sql_mode 合理設定MySql
- mysql中sql_mode值設定MySql
- MySQL的sql_mode解析與設定MySql
- laravel 解決 mysql only_full_group_by 問題LaravelMySql
- MySQL5.7中的sql_mode預設值MySql
- MySQL this is incompatible with sql_mode=only_full_group_by-錯誤解決MySql
- MySQL 5.7預設ONLY_FULL_GROUP_BY語義介紹以及故障解決MySql
- 搭建部落格時,被mysql的sql_mode中ONLY_FULL_GROMySql
- 踩坑系列:MySql only_full_group_by配置,竟導致所有應用報錯?MySql
- [905]MySQL的sql_mode解析與設定和MySQLdb._exceptions.OperationalError: (1055, “ExpressionMySqlExceptionErrorExpress
- Mac MySQL5.7 預設開啟 ONLY_FULL_GROUP_BY 模式問題與解決方案MacMySql模式
- [ERR] 1231 - Variable 'sql_mode' can't be set to the value of 'NO_AUTO_CREATE_USER'SQL
- Laravel-查詢-ONLY_FULL_GROUP_BY SQL 模式-報錯限制-解決LaravelSQL模式
- 沒想到,JDBC 驅動會偷偷修改 sql_mode 的會話值JDBCSQL會話
- MySQL - 初識MySQLMySql
- Warning:The /usr/local/mysql/data directory is not owned by the 'mysql' or '_mysql'MySql
- 「MySQL」 MySQL執行流程MySql
- 【Mysql】修改mysql時區MySql
- mysql + nodejs mysql篇(2)MySqlNodeJS
- MySQL(六):MySQL之MVCCMySqlMVC
- 【MySQL】MySQL中的鎖MySql
- MySQL入門--MySQL安全MySql
- MySQL入門--mysql命令MySql
- mysql 啟動報錯Can't connect to local MySQL server through socket '/data/mysql/mysql/mysql.sock'(111)MySqlServer
- MySQL入門系列:MySQL概述MySql
- 【MySQL】九、MySQL與IO.MySql
- MySQL:Lost connection to MySQL server at 'readingMySqlServer
- MYSQL學習(二) --MYSQL框架MySql框架
- Mysql入門【Mysql約束】MySql
- 【MySQL(2)| MySQL索引機制】MySql索引
- MySql(一) 淺析MySql索引MySql索引
- MySQL(二) MySql常用優化MySql優化