SELECT artist.name, recording.name, MAX(recording.length)
FROM recording
INNER JOIN (artist_credit
INNER JOIN (artist_credit_name
INNER JOIN artist
ON artist_credit_name.artist_credit=artist.id)
ON artist_credit_name.artist_credit=artist_credit.id)
ON recording.artist_credit=artist_credit.id
WHERE artist.gender=1
AND recording.length <= (SELECT MAX(recording.length) FROM recording)
GROUP BY artist.name, recording.name
ORDER BY artist.name
We are using the MusicBrainz database for school and we are having troubles with the "GROUP BY" because we have two columns (it works with one column, but not two). We want the result to display just one artist with his second longest recording time, but the code displays all the recording time of every song of the same artist. Any suggestions? Thanks.