Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Nature of SQL - Grouping

Status
Not open for further replies.

PeteAmsterdam

Programmer
Joined
Jun 3, 2005
Messages
76
Location
US
When you group based on one or more fields,
there will be other fields that aren't part of the grouping and you have to instruct the query what to do about it. In other words, anytime you use
GROUP BY, any fields not listed in this list have to have some kind of modifier in front of them, like min(), max(), or sum().

I'm having trouble
seeing how common table expressions or a UDF could get around that rule.

 
What is it that you are asking and want to do?
 
As long as non-grouped values correlate with grouped values you can use scalar aggregate or derived table + join.

------
"There's a man... He's bald and wears a short-sleeved shirt, and somehow he's very important to me. I think his name is Homer."
(Jack O'Neill, Stargate)
[banghead]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top