I have the following code to insert into a table, with commas to seperate values:
INSERT INTO tbltstr2 (main, tret) SELECT t1.main, treeref3 =REPLACE( (SELECT treeref3 AS [data()] FROM tbltstr t2 WHERE t2.main = t1.main ORDER BY treeref3 FOR XML PATH('') ), ' ', ', ') FROM tbltstr t1 GROUP BY main
The code continues to clear table tbltstr and repopulate it with fresh data. I would like to use this data to update
a third column in tbltstr2 (trem) in the same way, using commas to separate the data, rather than having multiple rows.