Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Group By in VFP 8
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00852868
Message ID:
00853259
Vues:
17
>>As others have posted, there is a "work around" for this behavior change. However, I have to ask, what kind of results are you looking for when you execute a query like this? Do you expect to get any meaningful data? The only valid values will be in Field1. All other data is suspect and should be treated as invalid.
>
>Here is the complete statement I was using:
>
>
>select *, count(field1) as cnt from tblData Group By field1
>
>
>and thank you for the help. :)

Do you use the data from the other fields? If not, why include them in the select in the first place? If so, you are using junk for data. Take the example that has a table with the records physically located like:
Field1     Field2     Field3
A          3          George
A          2          Fred
A          1          Herman
B          4          Jim
B          2          John
B          1          Tom
The following select statement:
select *, count(field1) as cnt from mytable group by field1
yields the following result set in VFP versions prior to 8
Field1     Field2     Field3     cnt
A          1          Herman     3
B          1          Tom        3
You totally lose the fact that Field2 and Field3 have other values stored in them. The GROUP BY clause causes VFP to return the last value, physically, in the table for the fields not contained in an aggregate. This gets even worse if you group by 2 fields.

Regards.
Larry Miller
MCSD
LWMiller3@verizon.net

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

Click here to load this message in the networking platform