Here is a updated sql query from the previous post, the list CA contact information, along with email, group membership and etc.
DECLARE @Contact nvarchar(max) = '%'
DECLARE @Group nvarchar(max) = '%'
DECLARE @Location nvarchar(max) = '%dallas%'
DECLARE @CN nvarchar(max) = '%'
select
u.first_name + ' ' + u.last_name as [CA Contact]
,ct.name as [Contact_Type]
,r.sym as [Access_Type]
,u.UserID
,u.Email_Address
,lg.Last_Login_Time
,l.Location_name as Location
,grp.Group_Membership
,ldap.LDAP_DN
--,u.*
from ca_contact u
-- ldap_dn
join usp_contact ldap on ldap.contact_uuid = u.contact_uuid
-- contact type
left join ca_contact_type ct on ct.id = u.contact_type
-- contact role
left join acctyp_V2 r on r.id = ldap.c_acctyp_id
-- location
left join ca_location l on l.location_uuid = u.location_uuid
-- last login
left join (
select contact, dateadd(ss,MAX(s.login_time)+32400,'1/1/1970') as Last_Login_Time from session_log s group by contact
) lg on lg.contact = u.contact_uuid
-- group membership
left join (
select distinct gm.member,
substring(
(
select ', '+g1.last_name as [text()]
from view_group g1
join grpmem gm1 on gm1.group_id = g1.contact_uuid
where gm1.member = gm.member and g1.inactive = 0
order by gm1.member
for XML PATH ('')
), 2, 1000) [Group_Membership]
from view_group g
join grpmem gm on gm.group_id = g.contact_uuid
-- list active groups only
where g.inactive = 0
) grp on grp.member = u.contact_uuid
where
-- active contacts only
u.inactive = 0
-- filter by Contact Name
and u.first_name + ' ' + u.last_name like @Contact
-- filter by Group Membership
and isnull(grp.Group_Membership,'') like @Group
-- filter by Location
and isnull(l.Location_name ,'') like @Location
-- filter by LDAP_DN
and isnull(ldap.LDAP_DN,'') like @CN
-- order by last name, first name
order by u.last_name, u.first_name