cdbcriteria check if relation is empty

I would like to show only books that dont have feedback.


$criteria = new CDbCriteria;

        $criteria->with = array('feedbacks');

        

        $criteria->compare('feedbacks.reserva', null);

or


$criteria->compare('feedbacks', null);

Thanks

try something like




$criteria->compare('feedbacks.id', null);



where "id" should be PK column from feedbacks table

or (I think better) do not join with feedbacks but instead:




$criteria->addCondition( 'NOT EXISTS (SELECT id FROM feedback WHERE feedback.id_book = t.id)' );



Thanks redguy, second aproach works .

Best way is to set up relation condition

$criteria->addCondition(‘feedbacks.id IS NULL’);

nice :)