答案 0 :(得分:0)
在SQL Server中,您可以将cross apply
与for xml path('')
结合使用以实现此目的:
select distinct t1.Id, t3.EmailAddress
from TABLE t1
cross apply (select t2.EmailAddress+' '
from TABLE t2
where t2.Id=t1.Id for xml path('')
) t3 (EmailAddress)
order by t1.Id