mirror of
https://github.com/doctrine/orm.git
synced 2026-03-23 22:42:18 +01:00
$qb->expr()->countDistinct() fails with multiple values #4929
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 @greeny on GitHub (Dec 10, 2015).
I have $qb (QueryBuilder), and i call this:
$qb->expr()->countDistinct('e.name', 'e.value')Generated SQL / DQL is valid, but Parser complains about syntax error:
Error: Expected Doctrine\ORM\Query\Lexer::T_CLOSE_PARENTHESIS, got ','In tests, there is a test for multiple arguments in
countDistinct(), but no test for Parser accepting multiple arguments forCOUNT(DISTINCT@oskargunther commented on GitHub (Jan 20, 2018):
Still not solved? Any work around?
@lart2150 commented on GitHub (Feb 9, 2018):
I found a major hack of a workaround. If you combine the two fields and then select distinct of the two it works.
COUNT(DISTINCT CONCAT(ps.date, s.id))@lcobucci commented on GitHub (Feb 22, 2018):
It would be amazing if someone could send us a failing test case that reproduces that behaviour. It would help us a lot to identify and fix the issue you're describing.
You can find examples on
388afb46d0/tests/Doctrine/Tests/ORM/Functional/Ticket@peter-gribanov commented on GitHub (Jan 2, 2025):
@lcobucci necro post #8058