signed

QiShunwang

“诚信为本、客户至上”

报错:Expression #1 of SELECT list is not in GROUP BY .......with sql_mode=only_full_group_by

2021/6/3 16:13:06   来源:

报错:Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggregated column ‘hospital.d.rugstoreId’ which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by


解决方案:

在MySQL执行下列语句

SELECT @@global.sql_mode

将结果中的sql_mode=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_ENGINE_SUBSTITUTION';

执行成功就可以正常运行了