文章詳情頁
mysql - sequel Pro中如何設置group by語句跑出來的結果默認該組的第一條記錄
瀏覽:161日期:2022-06-10 14:50:46
問題描述
select age,money from t1.gz group by age;發現報錯:Expression #2 of SELECT list is not in GROUP BY clause and contains nonaggregated column ’t1.gz.money’ which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by
問題解答
回答1:你現在的sql_mode不允許有非聚合字段以非聚合函數的形式出現,改一下sql_mode即可,或者min(id)取第一行記錄再連接原表獲取你要的結果
相關文章:
排行榜
