select keyword_id
from cr_keywords
where parent_id = :parent_id
and heading = :heading
delete from cr_item_keyword_map
where item_id = :item_id
and keyword_id in (select p.keyword_id
from cr_keywords p
where p.parent_id = :parent_id)
select parent_id
from cr_keywords
where keyword_id = :keyword
select keyword_id from cr_item_keyword_map
where item_id = :item_id
select km.keyword_id
from cr_item_keyword_map km,
cr_keywords kw
where km.item_id = :item_id
and kw.parent_id = :parent_id
and kw.keyword_id = km.keyword_id
select heading,
keyword_id
from cr_keywords
where [ad_decode $parent_id "" "parent_id is null" "parent_id = :parent_id"]
order by lower(heading)