sql - How to implement intersect in doctrine dql -
i'm looking way implement intersect function sql doctrine dql use queries. here query intersect result :
$sql1 = "select distinct o1 application\entity\object1 o1 inner join application\entity\object2 o2 o2.fkobject1 = o1.pkobject1 o1.etat = 'valide' , o2.pkobject2 = $id "; $sql2 = "select distinct o1 application\entity\object1 o1 inner join application\entity\object2 o2 o2.fkobject1 = o1.pkobject1 o1.etat = 'attente' , o2.pkobject2 = $id_2 "; $sql = "sql1 intersect $sql2 ";
// returns [syntax error] line 0, col 556: error: expected end of string, got 'intersect'
$query = $this->getentitymanager()->createquery($sql); $results = $query->getresult();
thanks.
the way worked me use many inner join :
$sql = "select distinct o1 application\entity\object1 o1 inner join application\entity\object2 o2 o2.fkobject1 = o1.pkobject1 inner join application\entity\object2 o3 o3.fkobject1 = o1.pkobject1 o1.etat = 'valide' , o2.pkobject2 = $id , o1.etat = 'attente' , o3.pkobject3 = $id_2 ";
hope helps.
Comments
Post a Comment