title: Mysql CASE - WHEN - THEN - returning wrong data type (blob)
body: <p>Im creating customizable product attributes in a web store - each attribute can have different type of data, each data type is stored in a separate column using corresponding mysql datatype.</p>
  
  <p>I Have a query like:</p>
  
  <pre><code>SELECT
  products.id AS id,
  products.sku AS sku,
  products.name AS name,
  products.url_key AS url_key,
  attributes.name AS attribute, 
  
  CASE
      WHEN `attribute_types`.`type` = 'text' 
          THEN product_attribute_values.value_text
      WHEN `attribute_types`.`type` = 'float' 
          THEN product_attribute_values.value_float
      WHEN `attribute_types`.`type` = 'price' 
          THEN product_attribute_values.value_float
      WHEN `attribute_types`.`type` = 'integer' 
          THEN product_attribute_values.value_integer
      WHEN `attribute_types`.`type` = 'multiple' 
          THEN product_attribute_values.value_text
      WHEN `attribute_types`.`type` = 'dropdown' 
          THEN product_attribute_values.value_text
      WHEN `attribute_types`.`type` = 'date' 
          THEN product_attribute_values.value_date
      WHEN `attribute_types`.`type` = 'textarea' 
          THEN product_attribute_values.value_textarea
  END as value
  
  from (...)
  </code></pre>
  
  <p>Now, the problem is that when <code>attribute_types</code>.<code>type</code> equals to ?some-type? i want it to return a value as it's stored in <code>product_attribute_values</code> table.
  Currently I get BLOb every time.</p>
  
  <p>Should I use type-casting or there's some behind-the-scene magic that I dont know about, OR maybe there's some better alternative ?</p>
  
  <p>EDIT:</p>
  
  <p>Everything seems to be OKAY (im checking price that is float) until i add a condition for TEXT (textarea).</p>