Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
SQL cumulative sums
Message
De
26/06/2019 09:44:05
 
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Titre:
SQL cumulative sums
Divers
Thread ID:
01669299
Message ID:
01669299
Vues:
61
Is there a way to have a cumulative field in a SQL expression?

If I had three records:
CREATE CURSOR t1 (cDesc c(10), nValue i)
INSERT INTO t1 VALUES("Record 1", 10)
INSERT INTO t1 VALUES("Record 2", 15)
INSERT INTO t1 VALUES("Record 3", 7)

SELECT cDesc, nValue, CUMULATIVE(nValue) as nCumulative ;
    FROM t1 ;
    ORDER BY 1 ;
    INTO CURSOR t2

BROWSE LAST NOWAIT
* Should produce a data set:
*     Record 1, 10, 10
*     Record 2, 15, 25
*     Record 3,  7, 32
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform