MSSQL中可以用STUFF函数拼接成字符串。
如:
SELECT FieldSomeElse, ( SELECT STUFF(( SELECT ‘,‘ + LinkField FROM Detail WHERE Id = Main.Id FOR XML PATH(‘‘) ), 1, 1, ‘‘) ) AS LinkFieldString FROM Main
时间: 2024-10-05 08:53:15
MSSQL中可以用STUFF函数拼接成字符串。
如:
SELECT FieldSomeElse, ( SELECT STUFF(( SELECT ‘,‘ + LinkField FROM Detail WHERE Id = Main.Id FOR XML PATH(‘‘) ), 1, 1, ‘‘) ) AS LinkFieldString FROM Main