title: Mysql CASE statement multiple columns
body: <p>I'm interested in making a case statement that pulls values from two different columns, one of which having a calculation involved.. I'm not sure how to make this work but I'll show you what I have so far. (I have one column that shows Item Type for example Special Order items, Discontinued Items and Items that are normally stocked.  And the Second column shows the Quantity on Hand - Quantity on Sales Orders to determine if the item is in stock.)  Here is my query </p>
  
  <pre><code>SELECT ItemID, ItemType, (QuantityOnHand - QuantityonSalesOrders) AS Instock
  CASE
  WHEN ItemType = 'SP / OR' THEN 'Special Order' 
  WHEN Instock &lt; '1' THEN 'Out of Stock' 
  WHEN Instock &gt; '0' THEN 'In Stock' 
  AS "Stock" FROM peachtree;
  </code></pre>