one of the documented procedures in this installation of the ACS
im_spam_multi_group_exists_clause   group_id_list
What it does:
returns a portion of an sql where clause that begins with " and exists..." and includes all the groups in the comma separated list of group ids (group_id_list)
Defined in: /web/philip/tcl/intranet-defs.tcl

Source code:

    set criteria [list]
    foreach group_id [split $group_id_list ","] {
	lappend criteria "(select 1 from user_group_map ugm where u.user_id=ugm.user_id and ugm.group_id='$group_id')"
    if { [llength $criteria] > 0 } {
	return " and exists [join $criteria " and exists "] "
    } else {
	return ""