title: How to use union query in criteria->condiion in Yii?
body: <pre><code>SELECT p_name
  FROM projects
  WHERE m_id =3
  UNION SELECT p.p_name
  FROM projects p, tasks t, users u
  WHERE t.t_assignee =3
  AND p.m_id =3
  AND u.role !=1
  </code></pre>
  
  <p>This is my query, and I want to implement this query in my model. I have used 3 tables in this query. Here comes my model projects. Here I want the list according to above query.</p>
  
  <pre><code>public function search()
  {
      // Warning: Please modify the following code to remove attributes that
      // should not be searched.
  
      $criteria=new CDbCriteria;
  
      $criteria-&gt;compare('project_id',$this-&gt;project_id);
      $criteria-&gt;compare('p_name',$this-&gt;project_name,true);
      $criteria-&gt;compare('m_id',$this-&gt;manager_id);
      $criteria-&gt;compare('description',$this-&gt;description,true);
  
  
          return new CActiveDataProvider($this, array(
          'criteria'=&gt;$criteria,
      ));
  
  
  
  }
  </code></pre>
  
  <p>How can I implement this query here?</p>
  
  <pre><code>$this-&gt;widget('zii.widgets.grid.CGridView', array(
  'id'=&gt;'projects-grid',
  'dataProvider'=&gt;$model-&gt;search(),
  'ajaxUpdate' =&gt; false,
  'filter'=&gt;$model,
  'columns'=&gt;array(
  array(
  'name' =&gt; 'project_id',
  'value'=&gt;'$data["project_id"]', //in the case we want something custom
    ),
  array(
  'name' =&gt; 'project_name',
  'value'=&gt;'$data["project_name"]', //in the case we want something custom
  ),
  array(
  'name' =&gt; 'manager_id',
  'value'=&gt;'$data["manager_id"]', //in the case we want something custom
                      ),
  array(
  'name'=&gt;'description',
  'value'=&gt;'strip_tags($data["description"])'
  ),  
  array(
  'class'=&gt;'CButtonColumn',
  'template'=&gt;'{view} {update} {delete}{createtask}{viewtask}',
  'buttons'=&gt;array
  (
  
  ),
  ),
  ),
  ));   
  </code></pre>
  
  <p>This is my cgridview view. Trying to get property of non-object still shows.</p>