Hi,
how to write the MYSQL Query
select count(*) from (SELECT user_id FROM `reports` group by report_id) as tb where tb.user_id=5
in Cakephp inside the Loop
$users=$this->User->find('all');
foreach($users as & $user):
//for each $user['User']['user_id']; which gives the User ids as 1 2 3 4 5 ...
endforeach;
$this->set('users', $users);