title: Case statement in MySQL
body: <p>I have a database table called '<strong>tbl_transaction</strong>' with the following definition:</p>
  
  <pre><code>id INT(11) Primary Key
  action_type ENUM('Expense', 'Income')
  action_heading VARCHAR (255)
  action_amount FLOAT
  </code></pre>
  
  <p>I would like to generate two columns: <code>Income Amt</code> and <code>Expense Amt</code>.</p>
  
  <p>Is it possible to populate the columns conditionally, using only a SQL Query, such that the output appears in the correct column, depending on whether it is an Expense item or an Income item?</p>
  
  <p>For example:</p>
  
  <pre><code>ID        Heading         Income Amt       Expense Amt
  1         ABC             1000             -
  2         XYZ             -                2000
  </code></pre>
  
  <p>I'm using MySQL as the database. I'm trying to use the CASE statement to accomplish this. </p>
  
  <p>Cheers!</p>