错误信息:
[Err] 1055 - Expression #3 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'test.user.SID'
which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by
测试得到结论:
mysql
的 sql_mode=only_full_group_by
模式下group by
分组查询的select
字段 ,除了group by
的字段之外其他的字段都要有聚合函数包裹,
如:sum
、avg
、max
、min
、count
。