Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Query with a running total
Message
De
13/12/2006 11:31:58
 
 
À
13/12/2006 11:27:26
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Versions des environnements
Visual FoxPro:
VFP 9
OS:
Windows XP
Database:
Visual FoxPro
Divers
Thread ID:
01137566
Message ID:
01177221
Vues:
16
>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.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform