1055 - Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggregated column
'rpacloudsit.t.app_id' which is not functionally dependent on columns in GROUP BY clause;
this is incompatible with sql_mode=only_full_group_by
MySQL有any_value(field)函數,他主要的作用就是抑制ONLY_FULL_GROUP_BY值被拒絕
官方有介紹,地址:https://dev.mysql.com/doc/refman/5.7/en/miscellaneous-functions.html#function_any-value
我們可以把select語句中查詢的屬性(除聚合函數所需的參數外),全部放入any_value(field)函數中;
例如:select name,any_value(sex) from test_table group by name
這樣sql語句不管是在ONLY_FULL_GROUP_BY模式關閉狀態還是在開啟模式都可以正常執行,不被mysql拒絕。