News for hackers. Stuff that matters.
Re:A query had to go by default-kramer on Tuesday June 06, 2017 @03:59PM (#14500744)
I don't have MySQL handy, but this query doesn't even look like it should work. It groups by "activities.activity_type_id" but then includes "activity_types.*" in the select list.

Unless MySQL is smart enough to do something like "implicit grouping" where if you group on the primary key it knows that all other columns of that table could also be included in the group... in which case I really should give MySQL another chance!

Re:A query had to go by Diederich on Tuesday June 06, 2017 @04:24PM (#14500959)
I believe MySQL does exactly this, but it's been a number of years since I worked with it in any depth.
Re:A query had to go by default-kramer on Tuesday June 06, 2017 @11:36PM (#14503559)
Ah, I found it. It turns out if you include nonaggregated columns it will just pick one value from the group arbitrarily.

https://dev.mysql.com/doc/refman/5.5/en/group-by-handling.ht...