Yii Framework Forum: Countbysql - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Countbysql COUNTBYSQL IN JOIN QUERY

#1 User is offline   Wizard Killer 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 2
  • Joined: 26-September 13

Posted 26 September 2013 - 12:48 AM

public function getrequestCountbyStudy()
{

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.
0

#2 User is offline   Wizard Killer 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 2
  • Joined: 26-September 13

Posted 26 September 2013 - 01:04 AM

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
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users