我有这个问题:
$em = $this->getDoctrine()->getEntityManager();
$query = $em->createQuery("SELECT u,COUNT(u) AS nb_renouvellement,
SUM(CASE WHEN f.`Criticity` = 'M' THEN 1 ELSE 0 END) nb_majeur,
SUM(CASE WHEN f.`Criticity` = 'C' THEN 1 ELSE 0 END) nb_critique
FROM AdminBlogBundle:AlertesBss2 f
GROUP BY f.BSC");
$listes = $query->getResult();
但我有这个错误
[语法错误]第0行,第45栏:错误:预期文字,得到'CASE'
答案 0 :(得分:-1)
批评不应该在引号中,并且应该由f.u
分组