Jira issue originally created by user yetanotherape:
I trying to execute query with subquery, which contains GROUP BY:
$subqueryBuilder = $repository->createQueryBuilder('l2')
->select('l2.id, DATE(l2.created) AS HIDDEN created_date')
$qb = $repository->createQueryBuilder('l');
$result = $qb->getQuery()->getArrayResult();
And got error:
[Syntax Error] line 0, col 80: Error: Expected Doctrine\ORM\Query\Lexer::T_FROM, got ','
If I group simply by "l2.created" without adding it to selected fields, all works fine. But I must use "DATE(l2.created) AS HIDDEN created_date" in selected statement to specify it in GROUP BY statement.
Comment created by @ocramius:
HIDDEN is expected to be used only to handle hydration. Your example is already invalid at SQL level, where it would result in something like:
That will obviously fail
Issue was closed with resolution "Invalid"
Comment created by yetanotherape:
Ok, so how I can do:
GROUP BY DATE(b.created)
You cannot right now.
That's not supported by all vendors - if you need such a query, use native SQL instead.