Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SQL cumulative sums
Message
From
26/06/2019 09:44:05
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
SQL cumulative sums
Miscellaneous
Thread ID:
01669299
Message ID:
01669299
Views:
60
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
Next
Reply
Map
View

Click here to load this message in the networking platform