|
-
Feb 6th, 2012, 02:18 PM
#1
Thread Starter
Junior Member
Re: A "balance" field that gets data from previous entries?
I'll try to rephrase my question.
Let's assume there is a table with 1 field - IntegerNumber.
I need to write a query whose result is the same length as the table, aka same number of rows, and there are 2 fields in the result of the query: The integer number (that's easy, just "select" it), and, for each row, the sum of all the integer numbers from the beginning of the table and until this row.
For example, if the table is:
2
4
1
1
10
I need a query whose result is:
2 2
4 6
1 7
1 8
10 18
I hope I am better understood now.
Thanks
Tova
-
Feb 6th, 2012, 03:52 PM
#2
Re: A "balance" field that gets data from previous entries?
 Originally Posted by sirkistova
I hope I am better understood now.
Unfortunately your last post is as clear as mud... 
Maybe you can provide us with exact table design and perhaps sample data from table - providing plain numbers without explaining what they represent is not going to work.
-
Feb 7th, 2012, 05:27 AM
#3
Thread Starter
Junior Member
Re: A "balance" field that gets data from previous entries?
Hello Rhino Bull,
Your first relpy gives field: remaining_balance
That is the 1st field that I need. Good.
Your second reply gives field: total_remaining_balance
This is the 2nd field that I need. But I need it for *every* remaining_balance.
Sum up ALL remaining_balances from the beginning and until the current one, for each remaining_balance. For each row with no grouping of rows that causes fewer rows in the result of the query.
For each row, sum-up the remaining_balance from this row and the total_remaining_balance from the previous raw, to calculate total_remaining_balance of this row, is what I need.
I'm afraid this is not possible with a query.
Perhaps what I need to do is calculate all remaining_balances and save in a temporary table. Then with VB code (not query) calculate all total_remaining_balances and append to every row in the table. Then display.
Thanks
Tova
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|