afeef
afeef

Reputation: 4706

Running Subquery in doctrine is not giving correct Result

sql

WHERE code= 'abc' AND (column_name NOT IN ('436') or column_name is null)

Doctrine code

            ->innerJoin('Bundle:Web', 'p', 'WITH', 'b.pid= p.id')
            ->where('a.code= :cust_id')
            ->andWhere('p.column_name  NOT IN ( :id)')
            ->setParameter('id', array_keys($id)[0])
            ->orWhere('p.column_name  is null')  

Running Dql gives different Result in Symfony2.

Upvotes: 0

Views: 39

Answers (1)

afeef
afeef

Reputation: 4706

solution that i tried

        ->innerJoin('Bundle:Web', 'p', 'WITH', 'b.pid= p.id')
        ->where('a.code= :cust_id')
        ->andWhere('p.column_name  NOT IN ( :id) or p.column_name  is null ')
        ->setParameter('id', array_keys($id)[0])

here in above dql it saves orWhere condition in dql.

Upvotes: 1

Related Questions