sql把相同条件的列值合并在一起,并用“;”分隔
时间:2021-07-01 10:21:17
帮助过:17人阅读
distinct TEMP.vch_number,
TEMP.vch_code,
vch_name
=stuff((select ‘;‘+vch_name from TABLEB where (vch_number=TEMP.vch_number and vch_name<>‘‘ ) for xml path(‘‘)),1,1,‘‘) FROM #TBL_READ_NUMBER
TEMP
sql把相同条件的列值合并在一起,并用“;”分隔
标签:sele XML sel pre 相同 col table nbsp height