+ " left outer join (select tag_id from library.toptag) tt on t.id = tt.tag_id"
+ " where ((occ.count > 5 and pop.sum/occ.count > 50)"
+ " or t.id in (select tag_id from library.toptag))"
+ " and not exists (select 1 from music.tagtopartist where tag_id = t.id)";
return jdbcTemplate.query(sql, new TagIdNameRowMapper());
}