Doctrine查询,错误

时间:2015-09-04 09:41:20

标签: sql symfony doctrine

我有疑问:

use Symfony\Component\HttpFoundation\JsonResponse;

$em = $this->getDoctrine()->getManager();
$query = $em->createQuery(
    'SELECT 
       Bank_ID, 
       Status, 
       COUNT(Bank_ID) 
    FROM 
       OmnisoftIntegBundle:IntClientBank 
    WHERE 
       status = 30 or status = 50 or status = 35 or status = 37 
    GROUP BY Bank_ID, Status;'
);

$result = $query->getResult();

return new JsonResponse(array('data' => $result, 'success' => true))

并且symfony显示错误:

  

[2/2] QueryException:[语法错误]第0行,第84行:错误:预期   字符串结束,获得'status'+ [1/2] QueryException:SELECT Bank_ID,   状态,COUNT(Bank_ID)来自OmnisoftIntegBundle:IntClientBank WHERE   status = 30或status = 50或status = 35或status = 37 GROUP BY   Bank_ID,状态;

1 个答案:

答案 0 :(得分:0)

尝试删除';'在查询结束时。