Can someone provide a little help on this?

 

I am trying to get a DISTINCT field from one table based on another table's
value.

 

 

public function getActiveStates(){

                                

                $params = array(

                                'contain' => 'Community',

                                'conditions' => array(

                                                'Community.status' =>
array('Active','Pending')),

                                'fields' => array(

                                                'DISTINCT State.name'));

                                

                return $this->find('list', $params);

                                

}

 

I am trying to get the DISTINCT State.name based on the Community table
based on the Community.status so end up with a list like Alaska, Georgia,
Illinois... and so on

 

They do have a Community belongsTo <-> State hasMany all set up

 

Thanks,

 

Dave

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to