select contact_search__log(:search_id,:user_id)
select title
from acs_objects
where object_id = :search_id
select cs.owner_id,
ao.package_id
from contact_searches cs,
acs_objects ao
where cs.search_id = ao.object_id
and cs.search_id = :search_id
select contact_searches.*, acs_objects.title, acs_objects.package_id
from contact_searches, acs_objects
where contact_searches.search_id = :search_id
and contact_searches.search_id = acs_objects.object_id
select type,
var_list
from contact_search_conditions
where search_id = :search_id
select count(distinct parties.party_id)
from parties, $cr_from group_approved_member_map
where parties.party_id = group_approved_member_map.member_id
$cr_where
and group_approved_member_map.group_id in ([template::util::tcl_to_sql_list [contacts::default_groups -package_id $package_id]])
$search_clause
select type
from contact_search_conditions
where search_id = :search_id
select count(distinct person_id)
from persons, $cr_from group_approved_member_map
where persons.person_id = group_approved_member_map.member_id
and group_approved_member_map.group_id in ([template::util::tcl_to_sql_list [contacts::default_groups -package_id $package_id]])
$cr_where
$search_clause
select count(distinct organization_id)
from organizations, $cr_from
group_approved_member_map
where organizations.organization_id = group_approved_member_map.member_id
and group_approved_member_map.group_id in ([template::util::tcl_to_sql_list [contacts::default_groups -package_id $package_id]])
$cr_where
$search_clause
select count(distinct person_id)
from persons, $cr_from
group_approved_member_map,
acs_rels
where persons.person_id = group_approved_member_map.member_id
and group_approved_member_map.group_id in ([template::util::tcl_to_sql_list [contacts::default_groups -package_id $package_id]])
and persons.person_id = acs_rels.object_id_one
and acs_rels.rel_type = 'contact_rels_employment'
$cr_where
$search_clause
select object_type
from contact_searches
where search_id = :search_id
select count(object_id_one)
from acs_rels
where rel_type = 'contact_rels_employment'
select distinct parties.party_id
from parties, $cr_from group_approved_member_map
where parties.party_id = group_approved_member_map.member_id
$cr_where
and group_approved_member_map.group_id in ([template::util::tcl_to_sql_list [contacts::default_groups -package_id $package_id]])
$search_clause
select type
from contact_search_conditions
where search_id = :search_id
select distinct person_id
from persons, $cr_from group_approved_member_map
where persons.person_id = group_approved_member_map.member_id
and group_approved_member_map.group_id in ([template::util::tcl_to_sql_list [contacts::default_groups -package_id $package_id]])
$cr_where
$search_clause
select distinct organization_id
from organizations, $cr_from
group_approved_member_map
where organizations.organization_id = group_approved_member_map.member_id
and group_approved_member_map.group_id in ([template::util::tcl_to_sql_list [contacts::default_groups -package_id $package_id]])
$cr_where
$search_clause
select distinct person_id
from persons, $cr_from
group_approved_member_map,
acs_rels
where persons.person_id = group_approved_member_map.member_id
and group_approved_member_map.group_id in ([template::util::tcl_to_sql_list [contacts::default_groups -package_id $package_id]])
and persons.person_id = acs_rels.object_id_one
and acs_rels.rel_type = 'contact_rels_employment'
$cr_where
$search_clause
select object_type
from contact_searches
where search_id = :search_id
select object_id_one
from acs_rels
where rel_type = 'contact_rels_employment'
select object_type
from contact_searches
where search_id = :search_id
select type
from contact_search_conditions
where search_id = :search_id
select distinct parties.party_id
from parties, $cr_from group_approved_member_map
where parties.party_id = group_approved_member_map.member_id
$cr_where
and group_approved_member_map.group_id in ([template::util::tcl_to_sql_list [contacts::default_groups -package_id $package_id]])
$search_clause
select distinct persons.person_id as party_id
from persons, $cr_from group_approved_member_map
where persons.person_id = group_approved_member_map.member_id
and group_approved_member_map.group_id in ([template::util::tcl_to_sql_list [contacts::default_groups -package_id $package_id]])
$cr_where
$search_clause
select distinct organizations.organization_id as party_id,
from organizations, $cr_from
group_approved_member_map
where organizations.organization_id = group_approved_member_map.member_id
and group_approved_member_map.group_id in ([template::util::tcl_to_sql_list [contacts::default_groups -package_id $package_id]])
$cr_where
$search_clause
select distinct persons.person_id as party_id
from persons, $cr_from
group_approved_member_map,
acs_rels
where persons.person_id = group_approved_member_map.member_id
and group_approved_member_map.group_id in ([template::util::tcl_to_sql_list [contacts::default_groups -package_id $package_id]])
and persons.person_id = acs_rels.object_id_one
and acs_rels.rel_type = 'contact_rels_employment'
$cr_where
$search_clause
select 1
from cr_items
where item_id = $party_id
and item_id in ( select member_id from group_approved_member_map where group_id in ([template::util::tcl_to_sql_list [contacts::default_groups -package_id $package_id]]))
[contact::search_clause -and -search_id $search_id -party_id "cr_items.item_id" -revision_id "cr_items.live_revision"]
select owner_id,
all_or_any,
object_type
from contact_searches
where search_id = :search_id
select type,
var_list
from contact_search_conditions
where search_id = :search_id