ORDER BY ad.name ASC, count(filter.value) DESC
Error: Expected end of string, got '('
SQLServer modifyLimitQuery does not work with aggregate functions in ORDER BY
I have the same problem using SUM() in ORDER BY. I think the doctrine documentation says, that you have to use an alias in ORDER BY. This works fine with MySQL, but fails in MSSQL, because MSSQL doesn't allow aliases in ORDER BY.
I think using aliases in DQL should be fine, so it's rather a problem in SQLServerPlatform class. Aggregate functions in ORDER BY are pretty basic stuff.
Issue should be moved to DBAL.
M.K. Thank you for investigating. I would like to move this ticket to DBAL because it is a DBAL issue. But I guess that makes two issues now because if I understand correctly, Flip did not use a limit/offset query modification but did not use an alias in the ORDER BY clause either but instead directly specified a COUNT() expression...
I can confirm it works when using an alias. Issue can be closed.
This issue refers to the same problem:
A related Github Pull-Request [GH-573] was closed:
Fixed in commit: https://github.com/doctrine/dbal/commit/4a7ff71ec3b57af7d70f1180897502f8a156d59b