15,899,679 members
Sign in
Sign in
Email
Password
Forgot your password?
Sign in with
home
articles
Browse Topics
>
Latest Articles
Top Articles
Posting/Update Guidelines
Article Help Forum
Submit an article or tip
Import GitHub Project
Import your Blog
quick answers
Q&A
Ask a Question
View Unanswered Questions
View All Questions
View C# questions
View C++ questions
View Javascript questions
View Visual Basic questions
View Python questions
discussions
forums
CodeProject.AI Server
All Message Boards...
Application Lifecycle
>
Running a Business
Sales / Marketing
Collaboration / Beta Testing
Work Issues
Design and Architecture
Artificial Intelligence
ASP.NET
JavaScript
Internet of Things
C / C++ / MFC
>
ATL / WTL / STL
Managed C++/CLI
C#
Free Tools
Objective-C and Swift
Database
Hardware & Devices
>
System Admin
Hosting and Servers
Java
Linux Programming
Python
.NET (Core and Framework)
Android
iOS
Mobile
WPF
Visual Basic
Web Development
Site Bugs / Suggestions
Spam and Abuse Watch
features
features
Competitions
News
The Insider Newsletter
The Daily Build Newsletter
Newsletter archive
Surveys
CodeProject Stuff
community
lounge
Who's Who
Most Valuable Professionals
The Lounge
The CodeProject Blog
Where I Am: Member Photos
The Insider News
The Weird & The Wonderful
help
?
What is 'CodeProject'?
General FAQ
Ask a Question
Bugs and Suggestions
Article Help Forum
About Us
Search within:
Articles
Quick Answers
Messages
Comments by Member 10361041 (Top 5 by date)
Member 10361041
5-May-15 22:31pm
View
ok, thanks! This is my first post in ever to ask a question. Anyway Thank you sooo much!
I tried to update my table. But i didn't look about select. This is what i searched. Thank you again.
http://www.mysqltutorial.org/mysql-tips/mysql-compare-calculate-difference-successive-rows/
And also i improve it for a my result.
select a.addedDateTime, a.credit, a.debit, a.balance from creditors a limit 1
union all
select a.addedDateTime, a.credit, a.debit, b.balance + a.debit - a.credit as balance
from creditors a inner join creditors b
on a.id - 1 = b.id
Thank you!
Member 10361041
5-May-15 22:16pm
View
Oh, sorry! I forgot to tell you I add another column which includes auto increment primary key. That's what i used as "id" in my procedure query.
That table also generating via procedure. Then i can edit it also!
Thank you!
Member 10361041
5-May-15 12:50pm
View
It's optional! it isn't depend on number of accounts. But if you can do it for one account we can improve it for all.
I found a solution using stored procedure. But if can give a single query for it, it's very useful!
Thank you!
Member 10361041
5-May-15 11:16am
View
Yes, u get it correctly! But your query is not works fine!
If your can please try it with a table and some rows.(3 or more rows)
columns should be "credit", "debit" and "balance".
eg :-
CREDIT, DEBIT, BALANCE
100 ,0 , 0
50 ,0 , 0
0 ,200 , 0
120 ,0 , 0
100 ,0 , 0
0 ,100 , 0
0 ,100 , 0
After process table row values should be
CREDIT, DEBIT, BALANCE
100 ,0 , -100
50 ,0 , -150
0 ,200 , 50
120 ,0 , -70
100 ,0 , -170
0 ,100 , -70
0 ,100 , 30
Member 10361041
5-May-15 8:07am
View
I'm working with accounting pack in java and i wanna generate reports just using queries without java codes.
I wrote a stored procedure to generate a result table using many data tables.
it has 5 columns. name, date, credit, debit and balance.
I wrote a query to fill data from other tables. But i couldn't calculate balance from credit and debit.
Balance = last balance + debit - credit;
But finally i could to write stored procedure for it.
Thank you!
Have you another solution?