#1055 - SELECT 列表的表达式不在 GROUP BY 子句中,并且包含与 sql_mode=only_full_group_by 不兼容的非聚合列

2021-11-20 00:00:00 mysql mysql-error-1055

我的查询:

select libelle,credit_initial,disponible_v,sum(montant) as montant 
FROM fiche,annee,type where type.id_type=annee.id_type and annee.id_annee=fiche.id_annee 
and annee = year(current_timestamp) GROUP BY libelle order by libelle asc

  • Mysql 5.7.9 运行查询没有任何问题,但 mysql 5.7.12显示上面的错误你能帮我吗
  • 推荐答案

    我很难让它工作我已经测试过它并且它在灯服务器 mysql 版本 5.12 上工作

    I had a struggle getting this to work i've tested it and it's working on lamp server mysql version 5.12

    那么,成功的步骤:

    1. sudo vim/etc/mysql/conf.d/mysql.cnf
    2. 滚动到文件底部复制粘贴

    1. sudo vim /etc/mysql/conf.d/mysql.cnf
    2. Scroll to the bottom of file Copy and paste

    <代码>[mysqld]sql_mode=STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION

    到文件底部

    1. 保存并退出输入模式
    2. sudo service mysql restart 重启 MySQL.
    1. save and exit input mode
    2. sudo service mysql restart to restart MySQL.

    完成!

相关文章