你好我有这个条款:
SELECT y,
CASE WHEN (v IS NULL) THEN 0 ELSE SUM(v.viewCount) END AS HIDDEN sumviewcount
FROM YTScraperBundle:YouTubeVideo y
LEFT JOIN y.allViews v WITH v.firstFetch BETWEEN :fromDate AND :toDate
GROUP BY y ORDER BY sumviewcount DESC
完全正常,但是当我尝试添加WHERE子句时,例如:
SELECT y,
CASE WHEN (v IS NULL) THEN 0 ELSE SUM(v.viewCount) END AS HIDDEN sumviewcount
FROM YTScraperBundle:YouTubeVideo y
LEFT JOIN y.allViews v WITH v.firstFetch BETWEEN :fromDate AND :toDate
WHERE y.name LIKE :videoName
GROUP BY y ORDER BY sumviewcount DESC
videoName的绑定方式如下:
$query->setParameter('videoName', "%" . $searchData['searchValue'] . "%");
所以这不是问题,无论如何我得到的错误是:
Error: Expected end of string, got 'y'","class":"Doctrine\\ORM\\Query\\QueryException