title: Recursive SQL- How can I get this table with a running total?
body: <pre><code>ID      debit   credit  sum_debit
  ---------------------------------
  1       150     0       150
  2       100     0       250
  3       0       50      200
  4       0       100     100
  5       50      0       150
  </code></pre>
  
  <p>I have this table, my problem is how to get <code>sum_debit</code> column which is the total of the previous row <code>sum_debit</code> with debit minus credit (<code>sum_debit = sum_debit + debit - credit</code>).
  each new row I enter debit but credit data is zero, or by entering the value of credit and debit is zero. How do I get <code>sum_debit</code>?</p>