代码如下,尝试按日期对交易进行分组。如果我使用 GROUP BY YEAR(t.createdDate), MONTH(t.createdDate), DAY(t.createdDate)
我收到以下错误:[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();
我只需要以每天的方式显示交易总数和金额总和。非常感谢任何帮助