I have a find (below) that selects all users so I can loop through them in 
a foreach on the view page. I need to add in some count fields that are 
separate from another table (one of the count finds is below).

How would you suggest I can do this easily?

$staffmembers = $this->User->find('all', array(
                        'fields' => array('User.id', 'User.first_name', 
'User.last_name'),
                        'conditions' => array('User.group_id' => 3),
                        'recursive' => 0
        ));

$currenttasks = $this->Task->find('count', array('conditions' => 
array('Task.completed' => 0, 'Task.user_id' => $staffmembers['User']['id'], 
'Task.due_date >' => date("Y-m-d"))));


So it can somehow be displayed on the page (code is not accurate, just to 
explain the situation):

foreach $staffmembers as $user 
{
  echo $user['User']['first_name'] - $currenttasks (for this user)
}



Is there a way to use a subquery or somehow make the currenttask a field 
selected in the first thing to get into the array?

Thanks

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
[email protected] For more options, visit this group at 
http://groups.google.com/group/cake-php

Reply via email to