>Thanks for the input. I've never relied, however, on this particular behavior since, AFAIK, it's not documented and I don't know if this behavior is the same on SQL Server 6.5 and/or Sybase, both of which don't include the restriction on non-aggregate fields being in the group by clause.
I've never relied on it either. I'd like to say that I've always written all my queries to conform to the "GROUP BY or aggregate" rule, but occasionally, I haven't. However, the only situations where I've knowingly broken the rules are in queries with parent-child relationships, where I was grouping on the parent PK and the field that wasn't in the GROUP BY or aggregates was from the parent record. Something like grabbing company name when grouping by company id.
Tamar
Précédent
Suivant
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