Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Using form property as control source for text box
Message
De
07/04/2005 14:12:01
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00996098
Message ID:
01002388
Vues:
13
>Got the following from a previous message that you posted.
>
>>The _TALLY after a query holds the number of records in the result not the >number of record matching the query criteria. In VFP9 a query with >aggreagate function, like SUM()/ MAX()/e.t.c, without GROUP BY clause >returns a single record with all nulls as required by ANSI SQL standard. >It's documented in SET ENGINEBEHAVIOR help topic. It actualy makes your >code simplier.
>
>>SELECT NVL(SUM(prem+expc+teri+late_fee+penalty),0) ;
>> FROM cur_ar WHERE LEFT(ALLTRIM(ar_type),1) == "C" ;
>> INTO ARRAY arTotalc
>>lnarTotalc = arTotalc
>
>It seems that if you add a GROUP BY clause to a MIN,MAX,COUNTY,SUM function SQL it makes the SQL results as in VFP8 - when there are no matching records. Either with or without the NVL, when there are no matching records the result set is empty and _tally is 0.
>Do you find this to be true?
>

This makes sense. When you have a GROUP BY clause, you're telling VFP to aggregate the data based on the fields listed in the GROUP BY. If no records make the cut (pass the tests in the WHERE clause), then there's nothing to aggregate, so no records turn up in the result.

When there's no GROUP BY clause, you're telling VFP to create a single aggregate representing the full data set. Thus, it creates one record reflecting that overall result.

This is another place where VFP 9 produces more accurate results than VFP 8.

Tamar
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform