mysql sql_mode=only_full_group_by问题?

时间:2021-12-05 05:08:45

mysql sql_mode=only_full_group_by问题?

视图查询的时候本地数据库报错:

mysql sql_mode=only_full_group_by问题?

解决办法:

1、查看sql_mode

select @@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

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';