Reputation: 3
I have following table:
TXT_Nr | TXTL_LineNr | TXTL_String | TXTL_Lgt|
-------|------------------|----------------|-----------|
10001 | 1 | hello, | 6 |
10001 | 2 | my name | 7 |
10001 | N-lines can be | ... | ... |
Next result required:
TXT_Nr | TXTL_String
--------|---------------
10001 | hello, my name
Upvotes: 0
Views: 35
Reputation: 4192
Using STUFF and GROUP BY method to concatenate string.
SELECT TXT_Nr , STUFF( (SELECT ',' + TXTL_String FROM #Table Inr WHERE
Inr.TXT_Nr = otr.TXT_Nr FOR XML PATH('')),1,1,'')
FROM #Table Otr
GROUP BY TXT_Nr
Upvotes: 1