我想从下面的查询中获取数据输出,并将所有电子邮件地址加在一起,用分号按员工姓名分组。
SELECT
DISTINCT
p.email
, e.name
FROM
PERSON p
INNER JOIN
EMPLOYEE e
ON
p.agentofrecord_id = e.employee_id
WHERE
dbo.GetPersonMember(p.person_id) = 1
AND (p.isactive = 1)
AND p.email <> ''
ORDER BY name