title: SubQueries in yii
body: <p>Am trying to code for a subquery </p>
  
  <pre><code>select * from mob_reg where name in (select name from auth where
  parent ="naga");
  </code></pre>
  
  <p>I followed all these answer's </p>
  
  <p>[Sub-queries ActiveRecord Yii
  [How to set multiple condition on criteria for CActiveDataProvider?</p>
  
  <p>But am getting  invalid arguments for foreach().</p>
  
  <pre><code>   $model=new MobReg('search');
  $model-&gt;unsetAttributes();
  
  
  $criteria = new CDbCriteria(array(
      'select' =&gt; 't.imei, t.emp_name, t.email, t.name',
      'join' =&gt; 'INNER JOIN auth ON (t.name = auth.name AND auth.parent = :parent)',
      'group' =&gt; 't.id',
      'params' =&gt; array(':parent' =&gt; 'naga')
  )); 
  $dataProvider = new CActiveDataProvider('MobReg', array(
          'criteria'=&gt;$criteria,
  ));
  
  &lt;?php $this-&gt;widget('zii.widgets.grid.CGridView', array(
      'id'=&gt;'mob-reg-grid',
      'dataProvider'=&gt;$dataProvider,
      'filter'=&gt;$model,
      'columns'=&gt;array(
          'imei',
          'emp_name',
                  'email',
                 'name',
          array(
              'class'=&gt;'CButtonColumn',
          ),
      ),
  )); ?&gt;
  </code></pre>
  
  <p>What I have to replace? any idea? where am I going wrong?</p>
  
  <p>I guess the problem am facing is in referencing two different tables, one in subquery and another in main query. how to handle this one?</p>