Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Group by clause
Message
 
 
À
16/03/2007 19:39:58
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Titre:
Divers
Thread ID:
01204878
Message ID:
01204910
Vues:
20
>Based on your and Freds response, it appears Group by is primarially usefull when there is a summation of som sort involved. Would you agree? It appears that if there are fields in the select that cannot be summed there is an error. Such as SELECT * FROM ORDERS GROUP BY DATE. I think I am having difficulty because I think of it as a group in the report designer.

Yes, groups in the report designer are entirely different beasts.

The SQL group is an aggregation. You roll up multiple records into one. You can sum, count, average, min, or max for the group but you'll still get only one record.

Your query above does not properly qualify the output against the group by. You're saying "GROUP THIS DATA BY DATE". OK, fine. It will make one record per date, but wait! Which values in the OTHER fields should it take?

If you have 10 rows on a specific date, which ONE value should the query grab? You're not saying. This is called an ambiguous query.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform