select distinct item_id as page_id
from xowiki_page_instancei
where item_id in (select item_id
from cr_items
where parent_id = :folder_id
and content_type = '::xowiki::PageInstance')
select name
from cr_items
where item_id = :item
delete from content_glossary_term_count
where folder_id = :folder_id
and term = :item_name