Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Fastest way for sum records
Message
From
07/12/2008 07:49:32
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivia
 
 
To
07/12/2008 02:15:19
Reza Meamar
Homa Programming Group
Shiraz, Iran
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 7 SP1
OS:
Windows XP SP2
Miscellaneous
Thread ID:
01365809
Message ID:
01365818
Views:
18
>Hi all,
>I have a table with at least 200000 records in it.
>IdField and Payment are its fields.
>What is the fastest way to getting sum of payment for some records?
>Is SUM command suitable for this?
>SUM Payment ALL FOR IdField=2134 TO SumPayment

You can use SUM as you showed, or a SELECT ... SQL. Visual FoxPro still has to process all the records that meet the criteria; the key to speed is to have an index that matches the expression. In this case, an index on ldField.
Difference in opinions hath cost many millions of lives: for instance, whether flesh be bread, or bread be flesh; whether whistling be a vice or a virtue; whether it be better to kiss a post, or throw it into the fire... (from Gulliver's Travels)
Previous
Reply
Map
View

Click here to load this message in the networking platform