title: How can I use an alias in a calculated expressions?
body: <p>Access SQL statements to MSSQL. I am having problems with using aliases within a calculated expression. Here is an example:</p>
  
  <pre><code>CASE WHEN AFACL.KGCOMPTI = 0 THEN 0 ELSE AFACL.VARGLINV END AS FaInventory, 
  CASE WHEN AFACL.KGCOMPTA = 0 THEN 0 ELSE AFACL.AMOUNT END AS FaPurch, 
  CASE WHEN AFACL.KGCOMPTM = 0 THEN 0 ELSE AFACL.VARGLINV * - 1 END AS FaVariance, 
  CASE WHEN AFACL.CDTAX = 2  THEN 0 ELSE ROUND((AFACL.MTLIGNE * GTAXL.T2RATE1 / 100), 2) END  AS TaxAmount2,
  CASE WHEN AFACL.CDTAX = 3 THEN 0 ELSE ROUND((AFACL.MTLIGNE * GTAXL.T1RATE1 / 100), 2) END AS TaxAmount1 ,  
  [FaInventory]+[FaPurch]+[FaVariance]+[TaxAmount2]+[TaxAmount1] AS [Payable]
  </code></pre>
  
  <p>The last line does not work. Can anybody out there help me out with this? I do not know any MSSQL, as I usually work with MS-Access. Thank you in advance</p>