本地安装的mysql5.5,服务器端安装的mysql5.7
所以在任务四中,进行多表联查中group by时,本地没有问题,服务器端报错:sql语句的问题
### SQL: select profession.*,count(people.id) as sum from people right join profession on people.type=profession.profId group by profession.profname
### Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'two.profession.profId' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by
; bad SQL grammar []; nested exception is com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'two.profession.profId' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by
算是一个小坑,本地和服务器端安装版本要一致;或者:mysql5.7默认启用了only_full_group_by SQL模式,对mysql进行配置。