1055 – Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggregated column ‘csc_risk.a.DefaultDate’ which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by, Time: 0.035000s
于是把部分数据迁移到本地进行测试, 发现sql语句可以执行
查看本地数据库版本
SELECT VERSION()
查询线上数据库版本发现确实是5.7版本
5.7.24
原因分析:MySQL5.7版本默认设置了 mysql sql_mode = only_full_group_by 属性,导致报错。
知道原因就好办, 查询怎么解决
下载安装的是最新版的mysql5.7.x版本,默认是开启了
only_full_group_by
模式的,但开启这个模式后,原先的group by
语句就报错,然后又把它移除了。一旦开启
only_full_group_by
,感觉,group by
将变成和distinct
一样,只能获取受到其影响的字段信息,无法和其他未受其影响的字段共存,这样,group by
的功能将变得十分狭窄了
only_full_group_by
模式开启比较好。因为在mysql
中有一个函数:any_value(field)
允许,非分组字段的出现(和关闭only_full_group_by
模式有相同效果)。
1、查看sql_mode
SELECT @@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
2、去掉ONLY_FULL_GROUP_BY 重新设置值
SET @@global.sql_mode ='STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION';
3、上面是改变了全局sql_mode 对于新建的数据库有效, 对于已存在的数据库,则需要在对应的数据下执行:
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';
以上方式临时解决没有问题的,数据库重启就需要重新设置
修改MySQL配置文件
Linux下my.cnf或Windows下My.ini
注意在[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
发布者:小站,转转请注明出处:http://blog.gzcity.top/4651.html
评论列表(9条)
Thank you for your sharing. I am worried that I lack creative ideas. It is your article that makes me full of hope. Thank you. But, I have a question, can you help me?
Galvanized Steel Pipes in Iraq ElitePipe Factory is renowned as one of the best and most reliable manufacturers of galvanized steel pipes in Iraq. Our galvanized steel pipes are produced with precision and high-quality standards, ensuring durability and resistance to corrosion. These pipes are ideal for a variety of applications, including water supply, construction, and industrial uses. With our state-of-the-art facilities and commitment to excellence, ElitePipe Factory has established a reputation for delivering top-notch products that meet the needs of our clients effectively. Discover more about our galvanized steel pipes by visiting our website at ElitePipe Iraq.
He reaches for and cups the wiggling low hangers of his teenage son. [url=https://arturzasada.pl/]polskie porno[/url] “I don’t wanna jack-off, dad.” He says flabbergasted to his dad as he turns off the tap to the hot and chilly water in the shower.
“Yes! Yes! I know you understand.” His father proudly exclaims. “You guys jerk off together, these days?” His dad asks, “Back when I was in high school me and several of my friends would jerk-off in our trucks in the parking lot. We were so horny we could barely sit in our seats. You ever do that Garrett?”
Exactly a week after, daddy texted me with a different tone saying, “ get your ass ready tonight cause daddy is coming to your place tonight.” He was usually really sweet and nice, I was shot when I got the message. But automatically I said, “ yes daddy!” I guess I am a slutty whore for him right at the beginning as I knew my place where is always going to be inferior. He reaches for and cups the wiggling low hangers of his teenage son.
“What are ya now, by the way?” I used my teeth to strip off daddy’s black sheer socks. I placed them in my mouth and washed them with my saliva. I swallowed every single sweat and stink from these socks. It takes so well. I rolled them into a ball and stuck them into my jockstrap where my small dick and balls were.
His father strokes his own cock in the shower, the dew from his cock mixes with the drops condensing on the glass.
Exactly a week after, daddy texted me with a different tone saying, “ get your ass ready tonight cause daddy is coming to your place tonight.” He was usually really sweet and nice, I was shot when I got the message. But automatically I said, “ yes daddy!” I guess I am a slutty whore for him right at the beginning as I knew my place where is always going to be inferior.
Thank you for your sharing. I am worried that I lack creative ideas. It is your article that makes me full of hope. Thank you. But, I have a question, can you help me?