mirror of
https://github.com/doctrine/orm.git
synced 2026-03-24 06:52:09 +01:00
Subquery in the SELECT clause with QueryBuilder ? #5663
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @sebastiaanviaene on GitHub (Sep 1, 2017).
Originally assigned to: @Ocramius on GitHub.
My question is simple , is it possible to do a subquery in the SELECT with QueryBuilder. I've tried looking this up but have gotten no success yet. Here's the code I have at the moment. :
` $qb = $this->getEntityManager()->createQueryBuilder();
$qb ->select('count(t.id)')
->from('AppBundle:Talent','t')
->where('t.status = :active')
->setParameter('active', 'ACTIVE');
But I get the error :
"[Syntax Error] line 0, col 10: Error: Expected IdentificationVariable | ScalarExpression | AggregateExpression | FunctionDeclaration | PartialObjectExpression | "(" Subselect ")" | CaseExpression, got 'SELECT'"
@Ocramius commented on GitHub (Sep 1, 2017):
This is not supported as per the EBNF