Error related to only_full_group_by when executing a query in MySql

前端 未结 18 2559
佛祖请我去吃肉
佛祖请我去吃肉 2020-11-21 04:39

I have upgraded my system and have installed MySql 5.7.9 with php for a web application I am working on. I have a query that is dynamically created, and when run in older ve

18条回答
  •  谎友^
    谎友^ (楼主)
    2020-11-21 05:02

    If you have this error with Symfony using doctrine query builder, and if this error is caused by an orderBy :

    Pay attention to select the column you want to groupBy, and use addGroupBy instead of groupBy :

    $query = $this->createQueryBuilder('smth')->addGroupBy('smth.mycolumn');
    

    Works on Symfony3 -

提交回复
热议问题