title: How do I use WHERE on Computed Column?
body: <p>I'm trying to get some queries written for some integrity across two tables. The query is something like this</p>
  
  <pre><code>SELECT if( o.is_discounted !=1, o.item_cost, o.discounted_item_cost ) AS order_item_total,
  SUM( oi.quantity * oi.price ) AS item_total
  FROM orders o
  INNER JOIN order_items oi ON oi.order_id = o.id
  WHERE order_item_total != item_total
  GROUP BY o.id
  </code></pre>
  
  <p>I've definitely used aliases to such columns in the past so I'm not sure why in this case it's telling me <code>order_item_total</code> is not a column.</p>