You are here
Home > Uncategorized > Calculate Balances from Debit and Credit Column in MySQL

Calculate Balances from Debit and Credit Column in MySQL

Hello Friends, Today I am going to share that how to calculate balances from debit and credit column in MySQL. If you have to show individual transactions and also want to keep a running balance column at the same time then this article will surely help you. Actually this query I was required to create in one of my project where I was developing a wallet system for user, so this concept can be used to create wallet system in your own project.

Create Table Query
The below create table query will create a table with name user_transactions.

Insert Query
The below query will add some data to table so that we can run select query on it.

Select Query
Finally the below query will result all the transactions with balance column of user whose id is 7.

Output

credit-debit-balance

 

Thanks for Visiting

Please do share if you find it useful

Rajesh Kumar Sahanee
I am a passionate Java Developer and I like Computer Programming. I love to do some interesting experiments and listening music in my free time.
https://www.zatackcoder.com

Comments

zatackcoder
Top

  Â