2015-09-04 33 views
0

我有查詢:主義查詢,誤差

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: [Syntax Error] line 0, col 84: Error: Expected end of string, got 'status' + [1/2] QueryException: 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;

+0

你知道IN謂詞可以很容易地爲你做或 - >或 - >或 - > ... - >或邏輯嗎? – DonCallisto

回答

0

嘗試刪除 ';'在查詢結束時。