title: Select an expression by CDbCriteria in Yii
body: <p>firstly, I using the codes below:</p>
  
  <pre><code>$c = new CDbCriteria();
  
  $c-&gt;select = '*, DATEDIFF(deadline_time, NOW()) AS day_left';
  $c-&gt;addCondition('DATEDIFF(deadline_time, NOW()) &gt; 0');
  $c-&gt;addCondition('DATEDIFF(deadline_time, NOW()) &lt; :diff');
  $c-&gt;params += array(':diff' =&gt; $diff);
  
  $assigns = UserAssign::model()-&gt;findAll($c);
  </code></pre>
  
  <p>the query works fine, but I want to add some new condition through relations, so the codes turned to like this:</p>
  
  <pre><code>$c = new CDbCriteria();
  $c-&gt;with = array('user');
  
  if(Yii::app()-&gt;user-&gt;model-&gt;isAreaAdministrator) {
      $c-&gt;addCondition('user.city_id = :cityId');
      $c-&gt;params += array(':cityId' =&gt; Yii::app()-&gt;user-&gt;model-&gt;adminCityId);
  }
  
  $c-&gt;select = '*, DATEDIFF(deadline_time, NOW()) AS day_left';
  $c-&gt;addCondition('DATEDIFF(deadline_time, NOW()) &gt; 0');
  $c-&gt;addCondition('DATEDIFF(deadline_time, NOW()) &lt; :diff');
  $c-&gt;params += array(':diff' =&gt; $diff);
  
  $assigns = UserAssign::model()-&gt;findAll($c);
  </code></pre>
  
  <p>After I add the <code>with</code> property, the query seems not working, it dump the message <code>trying
  to select an invalid column "DATEDIFF(deadline_time"</code> error.</p>
  
  <p>I'm newbie to Yii, could anyone help me? 
  Thanks.</p>