title: Adding the value of two columns in a query
body: <p>I have a debit and a credit column. If there is a value in the debit, the credit will be blank and vice versa. I am trying to calculate a net amount column which is debit - credit</p>
  
  <p>I am using the following:</p>
  
  <p>(Total:+NZ([debit],0)-nz([credit],0))</p>
  
  <p>The full query looks as follows:</p>
  
  <pre><code>INSERT INTO T_RECON ( REFERENCE, RECDATE, NET_AMOUNT, PROPID )
  SELECT REFERENCE, RECDATE, NET_AMOUNT, PROPID
  FROM (SELECT REFERENCE, RECDATE, (Total:+NZ([debit],0)-nz([credit],0)), PROPID
    FROM LEDGER_1
    WHERE PERIOD = 13 AND LEDGER_ACCOUNT = '55971'
    UNION ALL
    SELECT REFERENCE, RECDATE, (Total:+NZ([debit],0)-nz([credit],0)), PROPID
    FROM LEDGER_2
    WHERE PERIOD = 13 AND LEDGER_ACCOUNT = '55971'
  );
  </code></pre>
  
  <p>I am hoping to just see the debit - credit display in the <code>NET_AMOUNT</code> field. However, on the above I am getting a SYNTAX error. My query works just fine when I exclude the <code>NET_AMOUNT</code> part of the code</p>