I have a query in zf2 and doctrine orm. I am joining the result of two queries on the same table by its primary_key.
It seems, I am making a syntax error and not able to find out.
$query = $this->getEntityManager()->createQuery(
"select tc_result1.id as id ,tc_result1.displayId as displayId,tc_result1.activeFlag,tc_result1.hash
from
(
SELECT *
FROM (
SELECT id, display_id,active_flag,hash
FROM Test\Entity\TestCase tc_inner1
where tc_inner1.activeFlag=0 and tc_inner1.product = :productId
ORDER BY tc_inner1.displayId DESC
) a
GROUP BY hash
) AS tc_result1
join
(
SELECT *
FROM (
SELECT id, displayId,activeFlag,hash
FROM Test\Entity\TestCase tc_inner2
where tc_inner2.activeFlag=0 and tc_inner2.product = :productId
ORDER BY tc_inner2.displayId DESC
) a
GROUP BY hash
) AS tc_result2
on
tc_result1.id = tc_result2.id"
);
$query->setParameter("productId", $productId);
I got following error:
Additional information: Doctrine\ORM\Query\QueryException File: /var/www/test-suite/vendor/doctrine/orm/lib/Doctrine/ORM/Query/QueryException.php:63
Message:
[Semantical Error] line 0, col 153 near '(': Error: Class '(' is not defined.