Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to Accumulate field in SQL
Message
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00333469
Message ID:
00333489
Views:
12
>Hi.
>
>Anybody know of a way, in one pass, to accumulate a field with SQL code. I would like to do something like:
>Select Myfield,Cum(Myfield) as MyCum from myfile into cursor Mycursor
>To give following result:
>
>Myfield Mycum
>1 1
>3 4
>2 6
>8 14
>6 20 etc...
>
>regards,
>Gerard

Try doing your select with the COUNT() function to get the numbers of rows, or the SUM() function to get the total amounts of the data in the fields...

SELECT SUM(myfield), myfield GROUP BY myfield

HTH
Wayne Myers, MCSD
Senior Consultant
Forte' Incorporated
"The only things you can take to heaven are those which you give away" Author Unknown
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform