Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
SELECT SUM() gives me # than SUM... TO
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
00361638
Message ID:
00361643
Vues:
21
>>SELECT SUM(field) TO sfield FROM lv_diario INTO CURSOR query1
>
>Sorry is:
>
>SELECT SUM(field) AS sfield FROM lv_diario INTO CURSOR query1

I'm not sure why you are getting correct results when you add records. You shouldn't get correct results at all using table buffering and a SQL select. SQL select open the underlying tables/views again in a separate work area for several reasons (e.g. don't disturb record pointer, change index used for optimization purposes, etc.). Because of this, the underlying unchanged cursor is opened again not the one with the data modifications.

SUM works on the buffered table/view so its answer would be correct. The problem with this is it moves the record pointer to the end of the table/view. You'll have to reposition it to its starting point.
Larry Miller
MCSD
LWMiller3@verizon.net

Accumulate learning by study, understand what you learn by questioning. -- Mingjiao
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform