postgresql7.1 select s.slide_title, s.sort_key, wp_slide__get_preamble(:slide_item_id) as preamble, wp_slide__get_postamble(:slide_item_id) as postamble, wp_slide__get_bullet_items(:slide_item_id) as bullet_items, to_char(ao.creation_date, 'HH24:MI, Mon DD, YYYY') as modified_date from cr_wp_slides s, cr_items i, acs_objects ao where i.item_id = :slide_item_id and i.live_revision = s.slide_id and ao.object_id = s.slide_id select live_revision as attach_id, display, name as file_name from (select live_revision, name from cr_items where parent_id = :slide_item_id and content_type in ('cr_wp_image_attachment', 'cr_wp_file_attachment')) a left join cr_wp_image_attachments on (a.live_revision = attach_id)