关于group by使用MySQL提示错误 “#1055”
1055 - Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggregated column 't1.create_time' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by
原因
因为在5.7版本中默认使用了 ONLY_FULL_GROUP_BY 作为 SQL MODE
解决方案
为你的查询结果添加函数ANY_VALUE(),这个函数干嘛的呢
You can think of this ANY_VALUE() function as a strange a kind of aggregate function. Instead of returning a count, sum, or maximum, it instructs the MySQL server to choose, arbitrarily, one value from the group in question. It's a way of working around Error 1055.
您可以将此ANY_VALUE()函数视为一种奇怪的聚合函数。它不是返回计数,总和或最大值,而是指示MySQL服务器从所讨论的组中任意选择一个值。这是一种解决错误1055的方法。
延申
那么什么是所谓的SQL MODE?
翻译成中文大意为数据库模式,官方说法是为了让数据库与