select name, remove_threshold, coalesce(sc.songs,0) as songs, mp.playlist_id
from mp3_playlist_song_count sc
right join
mp3_playlists mp
using (playlist_id)
where mp.playlist_id=:playlist_id
select remove_threshold
from mp3_playlists
where playlist_id=:playlist_id
select sort_key,
mp.title as title, map.mp3_id as mp3_id, total, artist,
case when sign (total - :remove_threshold) = 1 then 't' else 'f' end as active_p
from mp3_mp3_playlist_map_view map,
mp3_mp3s_not_deleted mp
where map.playlist_id = :playlist_id
and map.mp3_id=mp.mp3_id
order by sort_key