Hi i have been struggling with the musicbrainz database, i just need to count the number of artists and the number of labels for each country, i think i have the counting labels sql query working but the count artists shows 5 artists for the first 50 results as i limited it to 50, and i assume that is wrong ?.
Any way i assume i have done something wrong with my join, can anyone please please show me what i have done wrong in the sql code below.
/* Q2: COUNT the number of artists and the number of labels by country */
SELECT COUNT(artist.id) AS "artist_count"
FROM artist
JOIN area ON artist.area = area.id
GROUP BY area.name;
SELECT area.name, COUNT(label.id) AS "label_count" <-- WAI - this one works as intended i think
FROM area
JOIN label ON area.id = label.area
GROUP BY area.name;
the nested statement with both combined.
SELECT aCounties, a.Label_cnt, b.Artist_cnt FROM
(SELECT area.name AS Counties, COUNT(label.id) AS Label_cnt
FROM area
JOIN label ON area.id = label.area
GROUP BY area.name) AS a,
(SELECT COUNT(artist.id) AS Artist_cnt
FROM artist
JOIN area ON artist.area = area.id
GROUP BY area.name) AS b LIMIT 50;