>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)