Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Query with a running total
Message
 
To
13/12/2006 11:27:26
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Environment versions
Visual FoxPro:
VFP 9
OS:
Windows XP
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01137566
Message ID:
01177221
Views:
15
>SELECT Date, Debit, Credit,;
>       NVL(SELECT SUM(Credit-Debit) FROM MyTable Tbl1 WHERE Tbl1.Date < MyTable.Date), CAST(0 AS N(12,2)) AS Balance;
>       FROM MyTable
>
>Hi,
>
>I refer to my earlier thread of wanting a running balance for debit and credit fields. I thank Borislav for the code he sent to me . However,the code works well if the running balance is for a particular date. But if there are many entries for a single date, all the running totals for a particular date period remain the same, even though the individual values of debit and credit are different. I would like to know how to get a running total based on the record number, and not the date.
>
>Thanks,
>
>
>
>Regards,
>
>Steve.
No way if you don't have some other field that can be used in the query. Other way it to make your field DateTime and store actial time when the user makes His/Her input.
Against Stupidity the Gods themselves Contend in Vain - Johann Christoph Friedrich von Schiller
The only thing normal about database guys is their tables.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform