title: Reference alias (calculated in SELECT) in WHERE clause
body: <pre><code>SELECT (InvoiceTotal - PaymentTotal - CreditTotal) AS BalanceDue
  FROM Invoices
  WHERE BalanceDue &gt; 0 --error
  </code></pre>
  <p>The calculated value <code>BalanceDue</code> that is set as a variable in the list of selected columns cannot be used in the <code>WHERE</code> clause.</p>
  <p>Is there a way that it can? In this related question (<a href="https://stackoverflow.com/q/3567863/264031">Using a variable in MySQL Select Statment in a Where Clause</a>), it seems like the answer would be, actually, no, you would just write out the calculation (<em>and</em> perform that calculation in the query) twice, none of which is satisfactory.</p>