I have this query :
SELECT DATE_FORMAT(exp_date, "%Y-%m") AS Month, sum(exp_total) FROM export
GROUP BY DATE_FORMAT(exp_date, "%Y-%m");
I tried to convert it to Symfony doctrine like below :
$qb = $this
->createQueryBuilder('e')
->select('DATE_FORMAT(e.expDate, \'%Y-%m\'), sum(e.expTotal) total')
->groupBy('DATE_FORMAT(e.expDate, \'%Y-%m\')');
return $qb->getQuery()->getResult();
Using:
"beberlei/DoctrineExtensions": "^1.0"
Error: [Semantical Error] line 0, col 103 near 'DATE_FORMAT(e.expDate,': Error: Cannot group by undefined identification or result variable.