Skip to content

Unsupported DQL 'SUM(props.id NOT IN (:propIds)) = 0' #11764

@richardhj

Description

@richardhj

Bug Report

Q A
Version 2.20

Summary

Trying to create this query:

SELECT PARENT_ID
FROM rel
GROUP BY PARENT_ID
HAVING SUM(PROP_ID NOT IN (5,1)) = 0
   AND SUM(PROP_ID = 1) = 1 
   AND SUM(PROP_ID = 5) = 1

(from https://stackoverflow.com/a/14113307)

Using

 $qb->andHaving('SUM(props.id NOT IN (:propIds)) = 0');

results in Expected Doctrine\ORM\Query\Lexer::T_CLOSE_PARENTHESIS, got 'NOT'.

Using

$qb->andHaving($qb0->expr()->sum($qb0->expr()->notIn('prop.id', ':propIds'), '0'));

results in Expression of type 'Doctrine\ORM\Query\Expr\Math' not allowed in this context.

Is this no Mysql-agnostic syntax maybe?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions