sql把相同条件的列值合并在一起,并用“;”分隔

mac2022-06-30  102

SELECT 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

 

转载于:https://www.cnblogs.com/Aaron-Lee/p/7552298.html

相关资源:JAVA上百实例源码以及开源项目
最新回复(0)