select rmaps.name, rmaps.id, jj.cnt from maps as rmaps
    inner join (
        select ifnull(proj.latest_map_id, maps.id) as id, count(1) as cnt from maps
            inner join djangoratings_vote as other
                on other.object_id = maps.id
            inner join djangoratings_vote as current
                on current.content_type_id = other.content_type_id
                and current.object_id != other.object_id
                and other.user_id = current.user_id
                and other.score >= current.score
            inner join maps_categories as curcats
                on current.object_id = curcats.map_id
            inner join maps_categories as othercats
                on other.object_id = othercats.map_id
                and curcats.category_id = othercats.category_id
            left join projects_project as proj
                on proj.id = maps.project_id
            where current.score >= 4
                and current.object_id = '127609'
            group by id
        ) as jj on rmaps.id = jj.id
    order by jj.cnt desc
    limit 0, 10;