Findall In Relational Tables With != Condition

Hi all…

I have two tables jobStatus and notifiactionRules, structures of tables are:


id : PK



id : PK

status_id : FK

i want to write a condition in findAll, such that i have to get the names of all job status that are NOT IN notifiactionRules.

I tried this:

$jobstatuslist = CHtml::listData(JobStatus::model()



                 'params'=>array(':status_id'=>NotificationRules::model()->findAll(),'id', 'job_status_id'))


but i am getting error - Undefined offset: 2

can anyone pls help…

Hi "reader"

check something like that


'condition' => YourAR2::model()->exists( ' = t2.status_id')->findAll()



you can also use SQL in findall, for instance in postgresql it would be something like

...::model()->findAll(array('condition'=> "not exists (select 'a' from notifiactionRules where notifiactionRules.status_id ="));

Hi ragua,

Thanks alot… it works perfect… thanks again… :)

I misunderstood 'not exist ’ by ‘exists’ so ragua solution is the correct :)