如何在学说2中使用Group By子句

时间:2013-01-10 08:39:30

标签: doctrine-orm symfony-2.1

如何将以下查询转换为doctrine2查询

with using method createQuery() or createQueryBuilder()

select customer,sum(marks) from BlogBundle:Customers group by customer

1 个答案:

答案 0 :(得分:0)

$qb->select('customer', 'SUM(marks)')->from('BlogBundle:Customers', 'customer')->groupBy('customer.id');