mysql查询报错: ORDER BY clause is not in GROUP BY..this is incompatible with sql_mode=only_full_group_by
2017-07-25 10:34
961 查看
在用mysql执行如下查询的时候:
报错信息如下:
错误的原因是我mysql版本是5.7的,使用如下语句查询可知
里面默认设置了
直接修改mysql配置文件(我的系统是Ubuntu16.04的,在
[mysqld]下
到此mysql配置文件的完整配置如下:
select * from `sys_user_group` group by `GROUP_ID`
报错信息如下:
[Err] 1055 - Expression #1 of ORDER BY clause is not in GROUP BY clause and contains nonaggregated column 'information_schema.PROFILING.SEQ' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by
错误的原因是我mysql版本是5.7的,使用如下语句查询可知
select @@sql_mode;
里面默认设置了
sql_mode=only_full_group_by
only_full_group_by:使用这个就是使用和oracle一样的group 规则, select的列都要在group中,或者本身是聚合列(SUM,AVG,MAX,MIN) 才行,其实这个配置目前个人感觉和distinct差不多的,所以去掉就好
直接修改mysql配置文件(我的系统是Ubuntu16.04的,在
/etc/mysql/mysql.conf.d/mysqld.cnf中并没有sql_mode这个配置,所以直接加上就好,如果是其他系统有得修改就不用添加了)
[mysqld]下
sql_mode=STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
到此mysql配置文件的完整配置如下:
[mysqld_safe] socket = /var/run/mysqld/mysqld.sock nice = 0 [mysqld] # # * Basic Settings # user = mysql pid-file = /var/run/mysqld/mysqld.pid socket = /var/run/mysqld/mysqld.sock port = 3306 basedir = /usr datadir = /var/lib/mysql tmpdir = /tmp lc-messages-dir = /usr/share/mysql skip-external-locking lower_case_table_names=1 character-set-server=utf8 sql_mode=STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION # # Instead of skip-networking the default is now to listen only on # localhost which is more compatible and is not less secure. #bind-address = 127.0.0.1 # # * Fine Tuning # key_buffer_size = 16M max_allowed_packet = 16M thread_stack = 192K
相关文章推荐
- mysql查询报错: ORDER BY clause is not in GROUP BY..this is incompatible with sql_mode=only_full_group_by
- SELECT list is not in GROUP BY clause and contains nonaggregated column this is incompatible with sql_mode=only_full_group_by
- mysql5.7建表时报错clause is not in GROUP BY..this is incompatible with sql_mode=only_full_group_by
- MySQL分组查询时出现错误SELECT list is not in GROUP BY ;this is incompatible with sql_mode=only_full_group_by
- ERROR 1055 (42000): Expression #1 of ORDER BY clause is not in GROUP BY..sql_mode=only_full_group_by
- mysql5.7.9新特性this is incompatible with sql_mode=only_full_group_by
- this is incompatible with sql_mode=only_full_group_by
- mysql5.7 命令gruop by报错 this is incompatible with sql_mode=only_full_group_by
- 报错:this is incompatible with sql_mode=only_full_group_by
- mysql语法错误:this is incompatible with sql_mode=only_full_group_by
- this is incompatible with sql_mode=only_full_group_by
- mysql 5.7 this is incompatible with sql_mode=only_full_group_by 问题
- this is incompatible with sql_mode=only_full_group_by
- 解决:mysql 5.7.9 [Err] 1055 ...this is incompatible with sql_mode=only_full_group_by
- MySQL Error this is incompatible with sql_mode=only_full_group_by
- [置顶] 【mysql 使用错误解决】this is incompatible with sql_mode=only_full_group_by
- 解决MySQL 5.7.9版本sql_mode=only_full_group_by问题,this is incompatible with sql_mode=only_full_group_by错误
- 解决 this is incompatible with sql_mode=only_full_group_by Details 问题 3ff0
- Mysql 升级到 5.7.16,group by 一直报home brew on columns in GROUP BY clause; this is incompatible with sql
- SQL---Expression #1 of ORDER BY clause is not in GROUP BY clause and contains nonaggregated column '