GROUP BY 查詢總報錯
ERROR 1055 (42000): Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'yatest.user2.id' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by
2018-03-17
檢查一下你的 select 的字段 ,取消里面不能分組的字段。
2018-03-26
謝謝 江南一號的回覆與解釋
我不明白的是,套以下的函示寫出你說的 "?select status, count(*) from user where id<=10 group by status "?該怎麼寫?
是?print_r($PdoMySQL->find($tables,'id>=5','count(*)','status'));會出現錯誤?
還是需要修改ParsFields函式?如何改?抱歉阿,我真的還是基礎班的....
2018-03-21
出現一樣的問題,當執行這句? print_r($PdoMySQL->find($tables,'id<=10','*','status'));
出現這樣的錯誤訊息:
SQLSTATE : 42000?
SQL Error : Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'imooc.user.id' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by
Error SQL : SELECT * FROM user WHERE id<=10 GROUP BY status
江南1號所說的“檢查一下你的 select 的字段 ,取消里面不能分組的字段”不太懂該怎麼做....求解,感謝先~