2013-01-10 119 views

回答

0

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

$ QB = $ EM-> createQueryBuilder(); $ qb-> select('tra.customer','SUM(tra.points)') - > from('AdminBundle:Transactions','tra') - > groupBy('tra.customer'); $; = $ qb-> getQuery() - > getResult();這是我真正的例子,當消除這個代碼得到以下錯誤[語義錯誤]行0,列11附近'客戶,SUM(tra.points)':錯誤:無效PathExpression。必須是StateFieldPathExpression。請幫助解決這個問題 – Rakhitha

+0

你應該' - > leftJoin('tra.points','points') - > addSelect('SUM(points.id)');' – Florian