postgresql7.1 select p.party_id, acs_object__name(p.party_id) as name, case when p.email = '' then '' else '('||p.email||')' end as email from parties p where 0 < (select count(*) from users u, party_approved_member_map m where m.party_id = p.party_id and u.user_id = m.member_id) select p.party_id, acs_object__name(p.party_id) as name, case when p.email = '' then '' else '('||p.email||')' end as email from parties p where 0 < (select count(*) from users u, party_approved_member_map m where m.party_id = p.party_id and u.user_id = m.member_id)