symfony2 group by date query
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
No comments:
Post a Comment