select cm.keyword_id,
ci.item_id,
cr.title,
to_char(cr.publish_date, 'Mon FMDD, YYYY') as pretty_publish_date
from cr_item_keyword_map cm,
cr_revisions cr,
cr_items ci
where cm.item_id = cr.item_id and
ci.latest_revision = cr.revision_id and
ci.parent_id = :parent_id and
ci.content_type = 'ca_ad'
$condition_stub
order by cm.keyword_id asc,
cr.title asc
select ci.item_id,
cr.title,
to_char(cr.publish_date, 'Mon FMDD, YYYY') as pretty_publish_date
from cr_revisions cr,
cr_items ci
where ci.item_id not in (select item_id
from cr_item_keyword_map cm
$condition_stub) and
ci.latest_revision = cr.revision_id and
ci.parent_id = :parent_id and
ci.content_type = 'ca_ad'
order by cr.title asc
select *
from cr_ca_adsx
where revision_id = :revision_id
select keyword_id
from cr_item_keyword_map
where item_id = :ad_id