时间:2021-07-01 10:21:17 帮助过:12人阅读
STUFF ( character_expression , start , length ,character_expression )
select TcodMedInst_GUID,stuff((SELECT ‘,‘ + DeptName+‘|‘+guid FROM TcodDeptHosContrast AS t WHERE t.TcodMedInst_GUID = tb.TcodMedInst_GUID FOR xml path(‘‘)), 1, 1, ‘‘) Dept from TcodDeptHosContrast tb
group by TcodMedInst_GUID
SQL分组合并
标签: