MySQL: difficulty understanding GROUP BY
I have difficulty understanding the correct use of the GROUP by clause in
MySQL. It is used in conjunction with aggregate functions. The pattern is:
SELECT column1, column2, ... column_n, aggregate_function (expression)
FROM tables
GROUP BY column1, column2, ... column_n;
But what I do not understand is whether I have to list, after GROUP BY,
all columns I did not perform an aggregate function on. What is the rule
for this? Thanks..
No comments:
Post a Comment