Timeline for SELECT list is not in GROUP BY clause and contains nonaggregated column .... incompatible with sql_mode=only_full_group_by
Current License: CC BY-SA 4.0
11 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Oct 22, 2022 at 22:00 | comment | added | Gustavo Martínez | It works for me! Your way is the correct way of solving this issue. You saved my day. | |
Jun 29, 2021 at 0:28 | comment | added | Amirreza Nasiri | +1 for "forcing you to think about what you really want to do". I wasn't doing what I really wanted to do! | |
Apr 21, 2021 at 15:27 | comment | added | Bird87 ZA | This should be the accepted answer. It answers the question of the best solution and explains why it doesn't work in the current setup. Not all developers have access to these settings or are allowed to change these settings. | |
Aug 26, 2020 at 10:33 | comment | added | Jcov | @TimBiegeleisen welcome to modern copy+paste development. "I don't need to think, someone who has read a random thing somewhere from an unreliable source has already done the thinking for me". | |
Aug 26, 2020 at 10:29 | comment | added | Tim Biegeleisen |
@Jcov ... and I couldn't agree with your comment more +1. Turning off the ANSI restriction on GROUP BY is almost always a bad idea. It scares me that so many users are taking the wrong advice and using it.
|
|
Aug 26, 2020 at 10:23 | comment | added | Jcov | +1 for me. I have no idea why the "accepted" answer above has been accepted. Your way is the correct way and the accepted answer is the usual hacky fix which will lead to more issues in future. | |
Sep 18, 2018 at 3:14 | history | edited | Tim Biegeleisen | CC BY-SA 4.0 |
added 474 characters in body
|
Jan 27, 2017 at 18:06 | comment | added | shmosel | Violating strict grouping doesn't necessarily produce incorrect results. I usually do it when the fields are guaranteed to be identical (e.g. a one-to-many join). And even if it's not guaranteed, selecting an arbitrary row will often be no more incorrect then using an aggregate function or adding a grouping level. | |
Jan 27, 2017 at 6:36 | comment | added | Pred | Just one note: The result is not incorrect (it follows MySQL rules), but it is unpredictable, meaning, columns not part of group by and not aggregated (and not functionally dependent) will return a 'random' value from the corresponding group. As the manual states: "the server is free to choose any value from each group" | |
Jan 27, 2017 at 5:39 | history | edited | Tim Biegeleisen | CC BY-SA 3.0 |
added 260 characters in body
|
Jan 27, 2017 at 5:34 | history | answered | Tim Biegeleisen | CC BY-SA 3.0 |