« first day (3827 days earlier)      last day (1051 days later) » 

2:01 AM
15 months to respond to that memory leak question 😅
2
@PaulWhite And a bright good golly to you.
 
2:48 AM
😀
 
 
4 hours later…
6:39 AM
A chairde - Morning all!
I think that there should be a tag for ONLY_FULL_GROUP_BY with an explanation of its perils &c... it seems to me that questions relating to it are becoming rarer in the wild of late, but it siill rears its ugly head from time to time - as in here:
1
Q: How to compact/group the results of a query by column's values?

sabI have the following table (MySQL version >= 5.7.X, using DBeaver 21.1.0 to manage the db): n_brand population actions_completed_by_unique_user pepsico pepsicoeur 1 pepsico pepsicoeur 1 pepsico pepsicoeur 1 pepsico pepsicousa 1 pepsico pepsicousa 2 pepsico pepsicousa 2 pepsico...

Spent way longer than I thought I would have to on it - it's tricky to explain clearly...
I'd happily write it up if I could be sure that it would be accepted as a tag?
It's difficult enough to marshall one's thoughts to clearly explain properly functioning SQL without having to go down that rabbit hole... a tag with a decent exposition of the whole ONLY_FULL_GROUP_BY débâcle might relieve some of the pain?
 
7:50 AM
No one reads tags for that sort of thing. Better to have a canonical Q & A I think
 
8:09 AM
It's a shame, but that's how it is
 
 
4 hours later…
12:11 PM
And you wouldn't look for it unless you knew in advance what it was - in which case, you'd have set it and it wouldn't be an issue!...
 
Right 🙂
That reminds me, I still need to organise copying ypercubeᵀᴹ's SO answer over
24
A: Is MySQL breaking the standard by allowing selecting columns that are not part of the group by clause?

ypercubeᵀᴹ Standard SQL would reject your query because you can not SELECT non-aggregate fields that are not part of the GROUP BY clause in an aggregate query This is correct, up to 1992. But it is plainly wrong, from 2003 and beyond. From SQL-2003 standard, 6IWD6-02-Foundation-2011-01.pdf, from http://ww...

 
 
2 hours later…
2:19 PM
@PaulWhite - I updated my answer in the light of @ypercubeᵀᴹ 's post - great link to this which as well as providing a justification for not having ONLY_FULL_GROUP_BY set (not fully convinced...) - but also gives a workaround - selecting MAX or MIN or whatever for the functionally dependent fields...
I think this hack is better than not having ONLY_FULL_GROUP_BY set - it's too big a hole for newbies to fall into... indeed, I recall that I fell into that hole before I embraced the Lord and saw the Light (err... I mean, found dba.se!)!
It's better because it's explicit and works query by query rather than having to fiddle with server settings!
 

« first day (3827 days earlier)      last day (1051 days later) »