Learn-SQL
Learn-SQL copied to clipboard
Updating a query that didn't work.
The solution for exercise 5 didn't work for me, it returned an error, so I thought that I could submit a fix. Thank you.
I also got an error. It worked if I grouped by bands.name. The method proposed by another member using WHERE worked for me and seemed like a more straightforward way of doing it.
The solution for exercise 5 didn't work for me either and the error was returned as follow:
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.
It should be working if you replace the 4th command line "GROUP BY albums.band_id" by "GROUP BY bands.id".
I personally think it might be due to albums.band_id is NULL which is not acceptable in MySQL. Also, WHERE is more straightforward in this case as @lzyslh mentioned above.