Learn-SQL icon indicating copy to clipboard operation
Learn-SQL copied to clipboard

Updating a query that didn't work.

Open lzyslh opened this issue 3 years ago • 2 comments

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.

lzyslh avatar Sep 27 '21 02:09 lzyslh

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.

Aunty-Nitty avatar Oct 12 '21 17:10 Aunty-Nitty

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.

lingyutan avatar Nov 12 '21 12:11 lingyutan