Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Group by - why?
Message
De
18/06/2004 08:17:01
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Titre:
Divers
Thread ID:
00914949
Message ID:
00914970
Vues:
9
>if i select from one of our transaction tables, maybe 30-50 fields do i have to list each of these fields in the group by?

If you use an aggregate function (SUM, COUNT, etc.), yes. But the real question is, Do you realy need all these fields to get the SUM/COUNT/etc. you need? IOW, Are all these fields needed to make a distinct key?

>what if i link tables?

Only the fields specified in the main SELECT need to be included in the GROUP clause.

Ex.: SELECT MyField1, MyField2, COUNT (*) FROM MyTable1 WHERE MyField3 EXIST IN (SELECT MyField3 FROM MyTable2) GROUP BY MyField1, MyField2


HTH
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform