Open
Description
Since Workbench seems to have been done away with, I had installed the 8.4 server and the 8.0.38 workbench. Apparently with the 8.4 server, sql_mode=only_full_group_by
is enabled by default. The problem with this is that
SELECT bands.name AS 'Band Name'
FROM bands
LEFT JOIN albums ON bands.id = albums.band_id
GROUP BY albums.band_id
HAVING COUNT(albums.id) = 0;
Does not work:
Error Code: 1055. Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggregated column
'record_company.bands.name' which is not functionally dependent on columns in GROUP BY clause;
this is incompatible with sql_mode=only_full_group_by
bands.name
is a non-aggregated column in the SELECT statement. The solution, I think, is changing GROUP BY albums.band_id
to GROUP BY bands.id, bands.name
.
Metadata
Metadata
Assignees
Labels
No labels