Code is as follows, trying to group transactions by date. If I use GROUP BY YEAR(t.createdDate), MONTH(t.createdDate), DAY(t.createdDate)
I get teh following error: [Semantical Error] line 0, col 173 near 'YEAR(t.creat': Error: Cannot group by undefined identification or result variable.
$transactions = $em->createQuery("SELECT SUM(t.amount) as amount, COUNT(t.id) as total FROM XXXCreatorMainBundle:Transaction t WHERE t.createdDate >= :createdStart AND t.createdDate <= :createdStop")
->setParameter('createdStart',$createdStart)
->setParameter('createdStop',$createdStop)
->getResult();
I just need to show the total # of transactions and sum of the amounts in a day by day fashion.. Any help is much appreciated
Neither of those functions come build-in Doctrine
, so so must either register them manually or install DoctrineExtensions
from GitHub repo as I'm sure that it has all of them prepared for use.
Also, take a look at this tutorial (last code block, to be more precise) on how to register functions from DoctrineExtensions
.
Hope this helps....