Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
SQL how to
Message
De
16/02/2003 10:54:09
 
 
À
15/02/2003 20:23:06
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Titre:
Divers
Thread ID:
00753795
Message ID:
00753882
Vues:
25
Try a SQL Self-Join similar to the below example:
CREATE CURSOR testdata (name c(1), amt y)
INSERT INTO testdata values('a',1)
INSERT INTO testdata values('b',2)
INSERT INTO testdata values('c',3)
SELECT x1.name, x1.amt, SUM(x2.amt) RUN_BAL FROM testdata x1 JOIN testdata x2 ON x2.name <= x1.name GROUP BY 1
>Hi,
>
>I am displaying a table in a grid, but i would like a calculated field to also be displayed. For example, the table has a column called Amount, I would like a new column called Running Balance recalculating the previous running balance plus current amount for the new running balance...
>
>RECNO   AMOUNT   RUNBAL
>1         1.00     1.00
>2         2.00     3.00
>3         3.00     6.00
>
>...I am having problems coming up with an SQL for the above( select amount,?????? as runbal from table into cursor). I hope someone can help.
>
>Regards
>Doug Johnston
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform