Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Confuse with grouping
Message
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Titre:
Confuse with grouping
Divers
Thread ID:
00843323
Message ID:
00843323
Vues:
79
I am trying to group information by getting total AMT for each SSN number. I tried the following but it doesn't work in vfp8. I get group by clause missing error. Here is my code:
SELECT Sarptp.name, Sarptp.ssn, SUM(Sarptp.amt), Sarptp.agency;
 FROM ti!sarptp;
 GROUP BY Sarptp.ssn;
 ORDER BY Sarptp.name
when I rewrite this to following:
SELECT Sarptp.name, Sarptp.ssn, SUM(Sarptp.amt), Sarptp.agency;
 FROM ti!sarptp;
 GROUP BY Sarptp.ssn, Sarptp.ti, Sarptp.name, Sarptp.agency;
 ORDER BY Sarptp.name
it totals my ANT right for each SSN. Can some clarify how it knows that I am trying total by SSN number vs lets say NAME (or other fields in group by clause)? Is it the order of precedence, in this instance the SSN being first field in group by? what about all the other fields in group by, does sql look at those? Sorry for asking stupid questions, I usually don't use group by in vfp 8 because they confuse me.

thanks
nick
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform