 <p>Try this and tell me:</p> <pre><code>SELECT a.seq_id, a.id, GROUP_CONCAT(cnt) AS cnt FROM music_artist AS a, ( SELECT ma.artist_id, CONCAT_WS('-', mgr.country_code, count(mgr.media_id)) AS cnt FROM music_album_artists AS ma JOIN media_geo_restrict AS mgr ON ma.album_id = mgr.album_id GROUP BY mgr.country_code ) AS count_table WHERE a.seq_id &gt; 0 and a.seq_id &lt; 10000 and a.id=count_table.artist_id group by a.id </code></pre>