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 cawv.*, aa.default_value, aa.attribute_name, aa.datatype from acs_attributes aa, ca_attribute_widget_values cawv, ca_attributes ca where aa.attribute_id = cawv.attribute_id and ca.attribute_id = aa.attribute_id and aa.object_type = :content_type and cawv.enabled_p = 't' and (ca.sitewide_p = 't' or ca.package_id = :package_id) order by aa.sort_order asc select * from cr_ca_adsx where revision_id = :revision_id