Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Catch 22 on group by
Message
De
19/05/2001 11:39:18
 
 
À
18/05/2001 08:29:42
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Syntaxe SQL
Divers
Thread ID:
00508311
Message ID:
00509089
Vues:
20
>> ... but in my opinion, SQL server has a big flaw in requiring every field in the group by - because in JOINED selects, you do NOT have the case you are indicating, but something more like:

Let's take a simplier example:
City        State
----        -----
Cincinnati  Ohio
Cleveland   Ohio
Columbus    Ohio
Dayton      Ohio
New York    New York
Albany      New York
SELECT City, State
FROM the_table
GROUP BY State

What values would you expect for City? The first? The last? BTW, which is the first or the last?

By requiring every column in the column list to be in either the GROUP BY or an Aggregate function, SQL Server is capable of determining the value w/o "guessing".

-Mike
Michael Levy
MCSD, MCDBA
ma_levy@hotmail.com
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform