[Err] 1055 - Expression #1 of ORDER BY clause is not in GROUP BY clause and contains 的問題 MySQL

kin-liny發表於2018-12-28

這幾天學習mysql時遇到不少問題,其中一個就是查詢sql執行時會出現一個錯誤,但也有查詢結果,在百度之後發現了一個有效的解決方法,下面是報錯資訊:[Err] 1055 - Expression #1 of ORDER BY clause is not in GROUP BY clause and contains nonaggregated column 'information_schema.PROFILING.SEQ' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by

解決方案:

select version(),
@@sql_mode;SET sql_mode=(SELECT REPLACE(@@sql_mode,'ONLY_FULL_GROUP_BY',''));

之後再執行

show variables like "sql_mode";

set sql_mode='';
set sql_mode='NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES';

然後再執行自己的sql就不會出現之前的錯誤了

 

 

 

 

原文連結:https://www.cnblogs.com/yaogengzhu/p/9570302.html

相關文章