How to create a running balance column based on account number? I have a stored procedure that returns account statement for one or multiple accounts
Here is the part I have issues with: returning a running balance in each record based on account number.
My query doesn't reset the balance for each account, how do I do this??

  SELECT 
    acc_account_transactions.account_no,
      COALESCE(debit_balance) as debits
     , COALESCE(credit_balance) as  credits
     , (@running_balance := @running_balance + (acc_account_transactions.debit_balance - acc_account_transactions.credit_balance)) as balance
  FROM acc_account_transactions
  JOIN (SELECT @running_balance := 0) r
  ORDER BY account_no


When running this, I get something like this, but the balance doesn't reset on each account

account  debit           credit             balance
13  |2578.19        | 0.00      |  2578.19
13  |1500.00        | 0.00      |  4078.19
13  |1500000.00     | 0.00      |  1504078.19
13  |1500.00        | 0.00      |  1505578.19
14  |1500000.00     | 0.00      |  3005578.19  &lt;--- reset before this
14  |0.00           | 13500.00  |  2992078.19
14  |0.00           | 13500.00  |  2978578.19
14  |33458.43       | 0.00      |  3012036.62
15  |0.00           | 100000.00 |  2912036.62  &lt;--- reset before this
15  |18506.34       | 0.00      |  2930542.96
16  |946.20         | 0.00      |  2931489.16  &lt;--- reset before this
17  |90364.77       | 0.00      |  3021853.93  &lt;--- reset before this
21  |0.00           | 0.00      |  3021853.93  &lt;--- reset before this
22  |0.00           | 0.00      |  3021853.93  &lt;--- reset before this
23  |0.00           | 0.00      |  3021853.93  &lt;--- reset before this
23  |1105500.00     | 0.00      |  4127353.93
24  |1327.00        | 0.00      |  4128680.93  &lt;--- reset before this
25  |0.00           | 0.00      |  4128680.93  &lt;--- reset before this


Thanks
It seems you need in simple 

SELECT *, SUM(debit_balance - credit_balance)
             OVER (PARTITION BY account_no ORDER BY id) balance
FROM acc_account_transactions


fiddle