Using Inner Join

We can user Inner Join to access record from more than two tables.

Here is the way to user Inner Join:




$criteria->with=array('messageto'=>array('on'=>'t.authorId=messageto.authorId'  ,'joinType'=>'INNER JOIN'));   

 $criteria->addCondition("t.threadOf=0AND messageto.messageStatusId=1 AND messageto.memberId=".$currentUserId);

$criteria->together=true;

$dataProvider=newCActiveDataProvider('Message', array('criteria'=>$criteria));