select gmm.member_id as party_id
from group_member_map gmm,
membership_rels mr
where gmm.rel_id = mr.rel_id
[template::list::filter_where_clauses -and -name "contacts"]
[template::list::orderby_clause -orderby -name "contacts"]
select admin_role.pretty_name as admin_role_pretty,
member_role.pretty_name as member_role_pretty
from acs_rel_roles admin_role, acs_rel_roles member_role
where admin_role.role = 'admin'
and member_role.role = 'member'
select groups.group_name,
groups.group_id,
( select count(distinct member_id) from group_approved_member_map where group_approved_member_map.group_id = groups.group_id ) as member_count
from groups left join ( select group_id, default_p
from contact_groups
where package_id = :package_id ) contact_groups on (groups.group_id = contact_groups.group_id)
where groups.group_id != '-1'
order by CASE WHEN groups.group_id = '[contacts::default_group]' THEN '000000000' ELSE upper(groups.group_name) END
select arr.pretty_plural,
art.rel_type as relation_type,
( select count(distinct gmm.member_id) from group_approved_member_map gmm where gmm.group_id = :group_id and gmm.rel_type = art.rel_type ) as member_count
from acs_rel_types art,
acs_rel_roles arr
where art.rel_type in ( select distinct gmm.rel_type from group_approved_member_map gmm where gmm.group_id = :group_id )
and art.role_two = arr.role
select gmm.member_id as party_id,
gmm.group_id,
gmm.rel_id,
gmm.rel_type,
contact__name(gmm.member_id,:name_order) as name,
mr.member_state,
party__email(gmm.member_id) as email,
( select first_names from persons where person_id = gmm.member_id ) as first_names,
( select last_name from persons where person_id = gmm.member_id ) as last_name,
( select name from organizations where organization_id = gmm.member_id ) as organization
from group_member_map gmm,
membership_rels mr
where gmm.rel_id = mr.rel_id
[template::list::filter_where_clauses -and -name "contacts"]
[template::list::page_where_clause -and -name "contacts" -key "gmm.member_id"]
select mr.member_state as state,
count(mr.rel_id) as num_contacts
from membership_rels mr, acs_rels r
where r.rel_id = mr.rel_id
and r.object_id_one = :group_id
and r.rel_type = 'membership_rel'
group by mr.member_state
select
object_type
from
contact_searches
where
search_id = :search_id
select
var_list
from
contact_search_conditions
where
type = 'group'
and search_id = :search_id
select
lam.attribute_id
from
ams_list_attribute_map lam,
ams_lists l
where
lam.list_id = l.list_id
$search_for_clause
$attribute_values_query
select
a.pretty_name
from
ams_attributes a
where
a.attribute_id = :attribute