MySQL_group by鎶ラ敊 [ERROR 1055 (42000): Expression #2 of SELECT list is not in GROUP BY clause]
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了MySQL_group by鎶ラ敊 [ERROR 1055 (42000): Expression #2 of SELECT list is not in GROUP BY clause]相关的知识,希望对你有一定的参考价值。
鏍囩锛?a href='http://www.mamicode.com/so/1/%e8%99%9a%e6%8b%9f' title='铏氭嫙'>铏氭嫙
only 渚濇嵁 table lis nbsp sql璇彞 ble mysq浠婂ぉ鏅氫笂鐢佃剳涓婄殑鏁版嵁搴撶獊鐒舵娊椋庯紝鎬庝箞涔熻繛涓嶄笂浜嗭紝鏌ヤ簡濂戒箙鐨勮祫鏂欒鍙兘鏄窡鎴戝湪鏈満鎼缓鐨刯ava椤圭洰鏈夊叧锛岃窡鐫€璧勬枡寮勪簡鍗婂ぉ锛岄棶棰樿繕鏄病鏈夎В鍐筹紝鍙ソ鍙︽眰鍑鸿矾銆?/p>
鎯宠捣涔嬪墠瀹夎杩囦竴涓猯inux铏氭嫙鏈猴紝灏辨兂鍊熺敤铏氭嫙鏈轰笂鐨剆ql锛屾病鎯冲埌鍦ㄥ啓鍒嗙粍鏌ヨ鐨勬椂鍊欎竴鐩存姤涓嬮潰杩欎釜閿欙細
ERROR 1055 (42000): Expression #2 of SELECT list is not in GROUP BY clause and contains nonaggregated column 鈥榰ser.t_user.name鈥?which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by
鍚屾牱鏌ヨ浜嗙綉涓婄殑鏁欑▼锛屽緱鐭ヤ簡闂鍑虹幇鐨勫師鍥狅細
銆€銆€mysql 5.7.5鍙婁互涓婂姛鑳戒緷璧栨娴嬪姛鑳姐€傚鏋滃惎鐢ㄤ簡ONLY_FULL_GROUP_BY SQL妯″紡锛堥粯璁ゆ儏鍐典笅锛夛紝MySQL灏嗘嫆缁濋€夋嫨鍒楄〃锛孒AVING鏉′欢鎴朞RDER BY鍒楄〃鐨勬煡璇㈠紩鐢ㄥ湪GROUP BY瀛愬彞涓棦鏈懡鍚嶇殑闈為泦鍚堝垪锛屼篃涓嶅湪鍔熻兘涓婁緷璧栦簬瀹冧滑銆傦紙5.7.5涔嬪墠锛孧ySQL娌℃湁妫€娴嬪埌鍔熻兘渚濊禆鍏崇郴锛岄粯璁ゆ儏鍐典笅涓嶅惎鐢∣NLY_FULL_GROUP_BY銆傛湁鍏?.7.5涔嬪墠鐨勮涓虹殑璇存槑锛岃鍙傝“MySQL 5.6鍙傝€冩墜鍐?rdquo;銆傦級
涔熷氨鏄濡傛灉鎯冲湪5.7.5涔嬪悗鐨勭増鏈甯镐娇鐢ㄥ垎缁勫姛鑳斤紝鍦╯elect鎸囧畾鐨勫瓧娈佃涔堝氨瑕佸寘鍚湪Group By璇彞鐨勫悗闈綔涓哄垎缁勭殑渚濇嵁锛涜涔堝氨瑕佽鍖呭惈鍦ㄨ仛鍚堝嚱鏁颁腑銆?/strong>
瀹樻柟杩欎箞瑙勫畾锛岃嚜鐒舵槸鏈夊畠鐨勯亾鐞嗭紝浣嗘槸鐢ㄤ範鎯簡涔嬪墠鐗堟湰鐨刧roup by锛岃繖涓€鏃跺崐浼氱殑涔熸敼涓嶈繃鏉ャ€?/p>
濂藉湪浠栦篃鍚屾椂鎻愪緵浜嗚В鍐虫柟妗堬紝濡備笅锛?/p>
銆€杈撳叆鏌ヨ璇彞锛?nbsp; SELECT @@GLOBAL.sql_mode;
杈撳叆鏌ヨ璇彞锛?nbsp; SELECT @@SESSION.sql_mode;
銆€绗竴椤?ONLY_FULL_GROUP_BY 灏辨槸闂鐨勬牴婧愶紝鎴戜滑鎶婂畠鍘绘帀灏卞ソ浜?/span>
銆€ 杈撳叆sql璇彞锛歴et sql_mode=鈥楽TRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION鈥?銆€
銆€璁剧疆鎴愬姛涔嬪悗锛屽啀娆℃煡璇ELECT @@SESSION.sql_mode; 灏变細鍙戠幇ONLY_FULL_GROUP_BY 杩欎竴椤瑰凡缁忔病鏈変簡锛屼絾鏄湪GLOBAL閲岄潰杩樹細鏈夛紝浣嗘槸涓嶅奖鍝嶆墽琛岋紝鎵€浠ヤ笉鐢ㄧ灏辫~
鍐嶆鎵ц涔嬪墠鐨勫垎缁剆ql璇彞锛屽氨涓嶄細鍐嶆姤閿欏悓鏍风殑閿欏暒 ~~~ 鎾掕姳锛屽紑蹇儈~
以上是关于MySQL_group by鎶ラ敊 [ERROR 1055 (42000): Expression #2 of SELECT list is not in GROUP BY clause]的主要内容,如果未能解决你的问题,请参考以下文章
鎶ラ敊璇?锛?ERROR Error: Uncaught (in promise): TypeError: Cannot read property 'name' of undefin
uiautomatorviewer杩炴帴鏈哄櫒鐐瑰嚮鎶ラ敊Unexpected error while obtaining UI hierarchy