title: mysql IF Else Statement
body: <p>Not sure how far a sql query can go with if/else statements. </p>
  
  <p>I have a simple SELECT statement:</p>
  
  <blockquote>
    <p>SELECT <code>amount</code>, <code>transtype</code> FROM
    <code>transactions</code></p>
  </blockquote>
  
  <p>The <code>transtype</code> column is going to be a number.</p>
  
  <p>For example, 1 = sale, 2 = refund, 3 = error, 4 = canceled, 5 = something else.... and so on.</p>
  
  <p>So, nothing complicated. But the list tends to grow for reporting reasons. Which is fine.</p>
  
  <p>For a specific query I'm working on, is there a way to extract that column as one of 2 or three specified numbers or text?</p>
  
  <p>For example, some transtype numbers are a 'loss', while others are a 'gain', and maybe others are 'neutral'. </p>
  
  <p>I'd like to extract that column with only those 3, without using php inside the html table I'm throwing the rows into.</p>
  
  <p>If my explanation is not clear, my apologies. It was hard to spit out.</p>