Esta é uma das vantagens de usar
JOIN
sobre o IN
predicado:SELECT
p.name,
COUNT(song_id) counter
FROM playlist p
INNER JOIN playlist_songs s ON p.id = s.playlist_id
GROUP BY playlist_id
HAVING COUNT(song_id) > 2;
JOIN
sobre o IN
predicado:SELECT
p.name,
COUNT(song_id) counter
FROM playlist p
INNER JOIN playlist_songs s ON p.id = s.playlist_id
GROUP BY playlist_id
HAVING COUNT(song_id) > 2;