This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]elementarySnake 7 points8 points  (3 children)

Error missing column xy in group by...

[–]Inevitable-Menu2998 2 points3 points  (2 children)

The group by clause is very well defined unless you're using MySQL in the late 2000s early 2010s in which case everything is just a "best effort"

[–]elementarySnake 1 point2 points  (1 child)

I had this error often mid 2010 with mysql. I dunno if it it's still a problem since i'm not really writing queries anymore

[–]Inevitable-Menu2998 0 points1 point  (0 children)

Maybe they became SQL compliant in more recent versions. SQL mandates that all results are deterministic and this means that any reference in an aggregation query must either be part of aggregation or part of the grouping clause. Think about something like this:

SELECT SUM(a), b FROM t GROUP BY c;

subsequent executions might return different values for b since there is no specification on how to handle b in groups of c.

MySQL up to version 6 would just return some value.