Information générale
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
>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
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement