I want to use ORDERBY COUNT()
sentence in Doctrine.
select p.name,count(p.id) from UserBundle:User p Order By count(p.id)
But it says.
[Syntax Error] line 0, col 58: Error: Expected end of string, got '('
However, with the following code:
select p.name,count(p.id) from UserBundle:User p Order By p.name;
it works.
Is there something wrong with Order by count()
on Doctrine? How can I use it?
I don't know doctrine, but when using databases you can usually do something like this:
I just did a quick search on Google and it should work in your case.