Countbysql
COUNTBYSQL IN JOIN QUERY

return $this->CountBySql('select itemid from tbl_archivelog left join tbl_study on study_coordinator='.Yii::app()->user->id.' left join tbl_item on studyid
where tbl_item.studyid=tbl_study.study_id and tbl_archivelog.itemid = tbl_item.item_id and requeststatus=1',itemid);

}

It does not seem to return the correct values kindly help identify the problem.

Just got it, the function works ok ...in the above query just leave it intact but only change SELECT itemid..to SELECT count(*)....but remember the last param must be what you it to count with ie itemid