select distinct
cpo.firstname,
cpo.surname,
details = stuff((select distinct ',' + cast(occ.detail as varchar)
from tblCrmContactObjects occ
inner join tblCrmContactObjectLinks ccol on ccol.crm_contact_object_id = occ.crm_contact_object_id
where cpo.crm_person_object_id = ccol.crm_object_id
order by 1
for xml path('')), 1, 1, '')
from tblCrmPersonObjects cpo
where cpo.firstname = 'Ashish'
|