0

I have two relation table "demande" and "reponse" which are linked and I'd like to retrieve all the lines of "demande" not in "reponse".

I try this with a join :

$select = new Select ();

$select->columns(array("id"));
$select->from ("demande" );
$select->where->lessThan("dateArretMarche",$stringDate );
$select->join(
    array("rep" => 'reponse'), // table name,
    'demande.id = rep.id_demande',array(),  
    $select::JOIN_RIGHT);

$select ->where->isNull("rep.id");//<== it doesn't work

But I can't select "null" lines". I guess it's possible with "not in" but Zend Framework provide only "in" predicate.

Thank all.

akond
  • 15,865
  • 4
  • 35
  • 55
Emmanuel Gauthier
  • 531
  • 2
  • 4
  • 15

2 Answers2

0

What if you just include it in the query? Like this:

$select ->where('rep.id IS NULL');
crazylpfan
  • 1,038
  • 7
  • 9
0

If you want to use isNull condition.So do you need to use with Predicate.Try with following code.

    $select->where(array(
        new \Zend\Db\Sql\Predicate\IsNotNull("rep.id")
            )
    );
UWU_SANDUN
  • 1,123
  • 13
  • 19