com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'XXXX.T.ID' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by
因爲出差,我把項目數據導出來放我本地做測試,結果遇到這個問題,看着代碼也沒錯,懵比了很久,百度了一下才知道,我的mysql版本是5.7.11,項目的是5.6.幾,在5.7以上的版本實現了對功能依賴的檢測,MySql默認啓用了only_full_group_by SQL模式,所以出來這個錯。。。
解決MySql查詢語句報Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggre異常的問題
但是處理的結果是
結果發現。。。set @@global.sql_mode後面多了個空格
(⊙o⊙)…