SQL Server 实现 MySQL group_concat
注释:连表查询时,子表单字段结果拼接
select DISTINCT(o.id),o.*,
CAST(stuff((
SELECT ',' + title FROM t_rm_sealapplycommondetail0 d WHERE d.pid = o.id FOR xml path('')
) , 1 , 1 , '') AS VARCHAR(255)) as titles
from t_rm_sealapplycommon o where 1=1