title: MySQL IF in SELECT clause?
body: <p>I've been working with mysql for a while but I'd never come across a problem where I had to use a condition up to now. Basically I need to do this (the best way for me to explain it is to write it as if mysql supported php like conditions):</p>
  
  <pre><code>SELECT `Gender`=='male' ? '0.5' : '1' AS Col1 FROM Users
  </code></pre>
  
  <p>Basically I want to have a 0.5 AS Col1 for all 'males' and a 1 for all 'females'.</p>
  
  <p>Eg:</p>
  
  <pre><code>UID Gender
  1   male
  2   female
  3   male
  </code></pre>
  
  <p>Should return:</p>
  
  <pre><code>UID Col1
  1   0.5
  2   1
  3   0.5
  </code></pre>
  
  <p>If you are wondering about the implementation. I want to recommend users "who to follow" based on their common habits. (0.5 to men means that they follow twice the number of women as men).</p>
  
  <p>How can this be done?</p>