What\'s wrong with this query:
SELECT co.*, mod.COUNT(*) as moduleCount, vid.COUNT(*) as vidCount
FROM courses as co, modules as mod, videos as vid
WHERE
Shoot this. I did the job with some non-mysql code:
function getAllWithStats($info='*',$order='',$id=0)
{
$courses=$this->getAll($info,$order,$id);
foreach ($courses as $k=>$v)
{
$courses[$k]['modCount']=$this->getModuleCount($v['id']);
$courses[$k]['vidCount']=$this->getVideoCount($v['id']);
}
return $courses;
}