我有一个查询如下:
SELECT t.id, t.name, count(i.id) FROM Acme\TestBundle\Entity\Tags t
LEFT JOIN t.items i WITH i.status=1 AND (SELECT count(img.id) FROM Acme\TestBundle\Entity\ItemsImages img WHERE img.item=i.id) > 0
GROUP BY t.id
ORDER BY COUNT (i.id) DESC
此查询在没有 ORDER BY 子句的情况下工作正常。每当我添加此子句时,它都会给我错误:
[Syntax Error] line 0, col 297: Error: Expected end of string, got '('
ORDER BY 适用于列名,但使用 count(i.id) 之类的列不起作用