title: Calculate balance from debit and credit column and select users in mysql?
body: <p>I have table accounts in which I have following 3 columns</p>
  
  <p>users_id, debit, credit</p>
  
  <p>I want to take out balance, so for that I need to check how many credit users have and then delete the debit from that and count as total balance for one user. And like this select all such users in one table, or total number of users with balance more than 1</p>
  
  <p>I have done like this</p>
  
  <pre><code>    SELECT * , (
  SUM( credit )
  ) - SUM( debit ) AS TotalBalance
  FROM accounts
  GROUP BY user_id
  </code></pre>
  
  <p>I want only users those who have more than one balance</p>