MSSQL中可以用STUFF函数拼接成字符串。
如:
SELECT FieldSomeElse, ( SELECT STUFF(( SELECT ',' + LinkField FROM Detail WHERE Id = Main.Id FOR XML PATH('') ), 1, 1, '') ) AS LinkFieldString FROM Main