First, you need to fix the query to use the tbl_release_artists
. I also added in table aliases to make the query more readable. These are abbreviations for table names, so repeated long names don't clutter up the query. Then you need to aggregate by each release using the group by
clause:
SELECT r.release_name, r.release_year, r.release_yt,
group_concat(a.artist_id) as artist_ids,
group_concat(a.artist_name) as artist_names
FROM tbl_release_artists ra join
tbl_releases r
on r.release_id = ra.release_id
tbl_artists a
on a.artist_id = ra.artist_id
GROUP BY r.release_year, r.release_name, r.release_yt
ORDER BY r.release_year, r.release_name ASC;
Of course, with multiple artists, ordering by the artist doesn't really make sense. So this just orders by release information.