I am having a hard time finding out why this Doctrine dql query is not working in my symfony application.
Mysql query is this:
SELECT
(COUNT(CASE WHEN c_email IS NOT NULL THEN 1 END) * 100.00) / COUNT(c_number) AS percentage
FROM
distinct_customers;
My Symfony doctrine php code is this
public function invalidEmails()
{
$em = $this->getEntityManager();
$qb = $em->createQuery('
SELECT (count(case when ds.c_email IS NOT null then 1 end))*100/count(ds.c_number) as percentage FROM App\Entity\DistinctCustomers ds');
return $qb->getResult();
}
But I get an error each time
[Syntax Error] line 0, col 69: Error: Expected Doctrine\ORM\Query\Lexer::T_ELSE, got 'end'
has someone ran into this in the past?