title: Decode function for MySQL
body: <p>I've this below sql:</p>
  
  <pre>
  SELECT 
      DATE_FORMAT(date_created, '%Y-%m-%d')   AS date_
      , IF(STATUS=1,'Success','Failed')       AS PROCESSED_STATUS
      ,COUNT(1)
  FROM 
      x
  WHERE 
      DATE_FORMAT(date_created, '%Y-%m-%d') BETWEEN  '2011-01-01' AND '2015-06-04'
  GROUP BY 
      DATE_FORMAT(date_created, '%Y-%m-%d')
      , STATUS
  ORDER BY 
      DATE_FORMAT(date_created, '%Y-%m-%d') DESC;
  </pre>
  
  <p>actually the format will shown like below</p>
  
  <pre>
  Date_       PROCESSED_STATUS    Count(1)
  2015-05-15  Failed              1
  2015-05-13  Failed              691
  2015-05-13  Success             68
  2012-05-19  Failed              346
  2012-05-19  Success             28
  2012-05-18  Failed              184
  2012-05-18  Success             18
  2012-05-17  Failed              176
  2012-05-17  Success             9
  2012-05-16  Failed              425
  2012-05-16  Success             49
  2012-03-13  Failed              1
  2012-02-23  Success             193
  
  </pre>
  
  <p>but I need this format:</p>
  
  <pre>
  Date_   Failed    Success
  </pre>
  
  <p>and inside on the data will shown the date and the count of failed and success.</p>
  
  <p>Usually on oracle, I use the decode function for this, but I don't know for mysql. please help :)</p>