select category_id from ec_categories where category_id=:category_id select count(*) from ec_categories where sort_key = (:prev_sort_key + :next_sort_key)/2