title: Difference between two columns in mysql
body: <p>I have two columns (<code>credit</code> and <code>debited_amount</code>) and I want to calculate the difference between them.</p>
  <p>Only need to retrieve records greater than zero or if the <code>debited_amount</code> field is Null.</p>
  <p>Never mind if the value is zero.</p>
  <p>Here is the SQL query which I have tried. Please help</p>
  <pre><code>SELECT
    `p_Id`,
    `user_id`,
    `doc_id`,
    `credit`,
    `app_date`,
    `expires_on`,(credit - debited_amount) AS credit
  FROM
    `wp_loyalty_credits`
  WHERE
    `expires_on` &gt; now();
  </code></pre>