oracle8.1.6 select t.template_id, t.name, t.description, t.filename, t.resource_dir, decode(m.template_id, null, ' ', 'checked') as checked from portal_templates t, portal_available_template_map m where t.type = 'layout' and t.template_id = m.template_id(+) and m.portal_id(+) = :default_portal_id order by t.name