I know I need to have (although I don't know why) a GROUP BY
clause on the end of a SQL query that uses any aggregate functions like count
, sum
, avg
, etc:
SELECT count(userID), userName
FROM users
GROUP BY userName
When else would GROUP BY
be useful, and what are the performance ramifications?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…