首页 > 数据库 >mysql 5.7 Expression #1 of ORDER BY clause is not in GROUP BY clause and contains nonaggregated colu

mysql 5.7 Expression #1 of ORDER BY clause is not in GROUP BY clause and contains nonaggregated colu

时间:2023-05-16 17:11:18浏览次数:53  
标签:... GROUP NO clause ZERO 报错 mode sql

https://www.shuzhiduo.com/A/gGdX3BNp54/

https://blog.csdn.net/wufaqidong1/article/details/126263023

 

使用mysql在执行一条插入语句时

  1. insert into channel(channel_id, channel_no,channel_name) values(1, '', "hhh");

报错: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

原因:sql _mode中only _full _group _by不兼容的问题

解决:去掉sql_mode中的only_full_group_by

先查看sql_mode:

  1. show variables like "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可以看到有ONLY_FULL_GROUP_BY,

设置去除ONLY_FULL_GROUP_BY:

  1. set sql_mode = 'STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION'

再次执行插入sql就不报错了

 

--实际操作代码

show variables like "sql_mode";
set sql_mode = 'STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION';

INSERT INTO `prescription` (`memo`) VALUES ('1063112');
alter table `prescription` AUTO_INCREMENT=1000000000;
INSERT INTO `prescription` (`memo`) VALUES ('1063112');

标签:...,GROUP,NO,clause,ZERO,报错,mode,sql
From: https://www.cnblogs.com/zhoading/p/17406217.html

相关文章

  • Golang URL query contains semicolon 报错解决方案
    ​ 报错信息http:URLquerycontainssemicolon,whichisnolongerasupportedseparator;partsofthequerymaybestrippedwhenparsed;seegolang.org/issue/25192 高版本http废除了分号做分隔符,会在http库中做报警输出,基础库代码如下:func(shserverHandle......
  • 【Mysql】update时报错:Lock wait timeout exceeded; try restarting transaction
    1、查找正在执行的事务SELECT*FROMinformation_schema.INNODB_TRX;2、杀掉LOCKWAIT的进程trx_mysql_thread_id:进程idkillxxxOR3、查看所有进程SHOWPROCESSLIST;4、杀掉异常的进程,比如Sleep状态、影响你正在操作的业务的进程id:进程idkillxxx......
  • 【遇到的问题】com.mysql.jdbc.MysqlDataTruncation 报错
    com.mysql.jdbc.MysqlDataTruncation:Datatruncation:Incorrectdatevalue:‘null’forcolum‘time’atrow1发现代码执行过程中数据存储失败,但是在数据库中执行语句又可以成功。在网络上搜索解决方案,但都解决无果:以为是String类型和Date类型转换的问题mysql-......
  • 有一分数序列:2/1,3/2,5/3,8/5,13/8,21/13...求出这个数列的前 20 项之和。
    有一分数序列:2/1,3/2,5/3,8/5,13/8,21/13...求出这个数列的前20项之和。#引入分数模块,可以出现分数fromfractionsimportFraction#数列的规律是:分子是前一个分数的分母和分子之和,分母就是这个分数在数列中的位置#求出数列前20项之和,以分数表示numerator=2#第一个......
  • Python_报错:curl: (7) Failed to connect to raw.githubusercontent.com port 443: Op
    解决:https://blog.csdn.net/Jimmmyking/article/details/126105788作为mac的用户,如果你还没安装Homebrew那真的就太遗憾了,应为其真的很好用,然后安装Homebrew有时候有不是那么简单,会出现很多奇奇怪怪的错误,如下是我本人第一次安装就成功,其重要用的是中科大的brew主体,使用这个只需......
  • dotnet6 项目在Docker部署报错 The type initializer for 'Gdip' threw an exception.
    asp.netcore部署在docker中,使用了System.Drawing.Common包,在容器中使用时报错“Thetypeinitializerfor'Gdip'threwanexception.”原因:因为System.Drawing.Common在跨平台的兼容性不够理想,官方设置为后续版本只能在Windows平台使用,默认是不开启的,需要在运行时配置中开启......
  • vue报错EISDIR: illegal operation on a directory, read解决
    报错:EISDIR:illegaloperationonadirectory,readInternalservererror:EISDIR:illegaloperationonadirectory,read原因:引入子组件时,子组件是xxx/文件夹名/index.vue,引入只写到了xxx/文件夹名解决:引入子组件时,路径写到xxx/文件夹名/index.vue......
  • 3D打印报错!! {"code":"key111", "msg": "Extrude below minimum temp
    问题:!!{"code":"key111","msg":"Extrudebelowminimumtemp 解决办法:在配置文件中修改:增加:min_extrude_temp:0......
  • 【jmeter】生成测试报告报错
    1、生成jmeter报告报错Consumerfailedwithmessage:Beginsize0isnotequaltofixedsize5 2、jmeter的jmx格式的聚合报告转换成html时报错Anerroroccurred:Reportgenerationrequirescsvoutputformat,check'jmeter.save.saveservice.output_format'proper......
  • 报错问题:谷粒商城Access to XMLHttpRequest at 'http://localhost:88/api/sys/login'
    大概在P46P47,跟着配置后出现问题AccesstoXMLHttpRequestat'http://localhost:88/api/sys/login'fromorigin'http://localhost:8001'hasbeenblockedbyCORSpolicy: 上网查了一下,说是跨域的问题,检查了一会,有人说是nacos的命名空间的问题,也有人说是版本上的问题,大多......