Doctrine2 Limit the rows to sum in a query -


i have query return sum, want limit number of rows query, not working.

this query:

    $qb = $this->createquerybuilder('result')         ->select('sum(result.generalpoints) generalpoints, sum(result.coefficient) coefficient')         ->join('result.inscription', 'inscription', join::with, 'inscription.user = :user')         ->join('inscription.race', 'race')         ->join('inscription.category', 'category', join::with, 'category.generalranking = true')         ->join('race.event', 'event')         ->join('event.competitionseason', 'competitionseason', join::with, 'competitionseason = :competitionseason')         ->orderby('generalpoints', 'desc')         ->addorderby('coefficient', 'desc')         ->setparameter('competitionseason', $competitionseason)         ->setparameter('user', $user);      if (isset($limit)) {         $qb->setmaxresults($limit);     }      return $qb->getquery()->getoneornullresult(); 

some idea ?

thanks

as sum aggregation function result 1 row, limit statement applied afterwards. need create subquery producing multiple rows generalpoints , coefficient, limit number of rows in subquery , use aggregation function in wrapping query.


Comments

Popular posts from this blog

javascript - jQuery: Add class depending on URL in the best way -

caching - How to check if a url path exists in the service worker cache -

Redirect to a HTTPS version using .htaccess -