select c.category_id, c.name, c.short_name, (select count(*) from pinds_blog_entries e where e.category_id = c.category_id) as num_entries from pinds_blog_categories c where c.package_id = :package_id order by upper(c.name), c.name select short_name from pinds_blog_categories where package_id = :package_id select count(*) as category_exists from pinds_blog_categories where category_id = :category_id select count(*) as short_name_exists from pinds_blog_categories where short_name = :short_name and category_id <> :category_id and package_id = :package_id select name, short_name from pinds_blog_categories where category_id = :category_id