title: How can I properly use IF statement in doctrine and SELECT AS?
body: <pre><code>$query = Doctrine_Query::create()
  -&gt;select('IF(m.sender_id = ?, m.receiver_id, m.sender_id) AS uid', $my_id)
  -&gt;from('Message m')
  -&gt;where('m.receiver_id = ? OR m.sender_id = ?', array($my_id,$my_id))
  -&gt;groupBy('uid')
  </code></pre>
  
  <p>I am unable to group by 'uid', as if AS uid is not working at all...</p>
  
  <p>If I try to retrieve generated sql via ->getSqlQuery() and try it directly in Mysql, it works.</p>
  
  <pre><code>SELECT IF(s.sender_id = 1, s.receiver_id, s.sender_id) AS s__0 
  FROM message s 
  WHERE (s.receiver_id = 1 OR s.sender_id = 1) GROUP BY s__0
  </code></pre>