Comments - ONLY_FULL_GROUP_BY wrong behaviour
Content reproduced on this site is the property of its respective owners,
and this content is not reviewed in advance by MariaDB. The views, information and opinions
expressed by this content do not necessarily represent those of MariaDB or any other party.
I don't think it is a bug. It appears that this feature (not restricting selection of functionally dependent non-aggregated columns when ONLY_FULL_GROUP_BY is enabled) has not been implemented yet. Look at this issue: https://jira.mariadb.org/browse/MDEV-11588
You can either disable ONLY_FULL_GROUP_BY or make all columns from the SELECT clause aggregated.
It doesn't matter if you have more than 1 row per group. What matters is the uniqueness of the values of the non-aggregated columns. For example, if you have a group where a non-aggregated column has the same value for every row, then it matters not from which row the engine selects the corresponding value from.