Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
322 views
in Technique[技术] by (71.8m points)

mysql - I have a syntax error in my query builder

`$allConsultation = $this->getDoctrine()
        ->getRepository(Consultation::class);
    $spConsultation = $allConsultation->createQueryBuilder('c')
                    ->select('c')
                    ->addselect('user')
                    ->addselect('p')
                    ->leftJoin('c.serviceProvider', 'user')
                    ->leftJoin('c.pricingModel', 'p')
                    ->select('MONTH(c.scheduleAt) AS m','(c.serviceProvider) AS sp')
                    ->where('user.refer_token=:token')
                    ->setParameter('token',$serviceProvider->getToken())
                    ->andwhere('c.status= :s_id')
                    ->setParameter('s_id', 'Finished')
                    ->groupBy('sp')
                    ->getQuery()
                    ->getResult();`

SQLSTATE[42000]: Syntax error or access violation: 1055 Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'illicon.c0_.schedule_at' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by

question from:https://stackoverflow.com/questions/65843331/i-have-a-syntax-error-in-my-query-builder

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...