I want to select two row values in a row and concatenated.
id value
------------
1 abc
1 def
2 ghi
3 jkl
3 mno
3 prs
Result should look like:
id value
------------
1 abc, def
2 ghi
3 jkl, mno, prs
How can i do that?
The link @Dems posted is functionally identical to your requirements.
However, in case you don’t have access to the xml functions, here’s a recursive CTE version:
If you have a unique index on the initial table, the
IndexedCTE can be replaced with a reference to your original table.