我想算一下来自乌克兰的用户,但我有错误。
[Semantical Error] line 0, col 192 near 'Ukraine GROUP': Error: 'Ukraine' is not defined.
500 Internal Server Error - QueryException
我如何理解问题在于我如何输入乌克兰价值。
public function Action(){
$em = $this->getDoctrine()->getEntityManager();
$qb = $em->createQueryBuilder();
$qb->add('select', 'count(user.id) as recount, ur.country, ur.year, ur.month, ur.day')
->add('from','CobaCoreBundle:User ur')
->add('where', $qb->expr()->andx(
'ur.date <= :end',
'ur.date >= :start',
'ur.country = Ukraine'
))
->setParameter('start',$period['fromd'])
->setParameter('end', $period['tod']);
$qb->add('groupBy','ur.year, ur.month, ur.day');
}
答案 0 :(得分:2)
字面值应括在语音标记中:
'ur.country = "Ukraine"'