- 解决 mysql5.7 及以上版本 group by 遇到的Expression
去除 ONLY_FULL_GROUP_BY模式,重新设置值
// 临时:执行sql命令如下
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';// 永久:my.ini配置文件中增加
#关闭ONLY_FULL_GROUP_BY
sql_mode= 'STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION'
- 去除organization表name列数据的空格
update organization set name = REPLACE(name,' ','') ;
- 查看时不显示空格
// TRIM()
SELECT TRIM(name) FROM organization;
// REPLACE()
SELECT REPLACE(name,' ','-') FROM organization; // 用-代替空格
- 陆续补充