Q:

Update second column into one

I would like to update multiple colums into one column of an another table:
I am using MS SQl Server
Table 1:
Num | ColumnA | ColumnB  |
--------------------------
1   | Peter   | Mueller  |
1   | Jonny   | Corleone |
2   | John    | Cohn     |
1   | Sarah   | Wood     |

Now I want to update ColumnA and ColumnB into ColumA of Table2 like this:
Table2:
Num | ColumnC                                      |
----------------------------------------------------
1   | Peter, Mueller, Jonny, Corleone, Sarah, Wood |
2   | John, Cohn                                   |

A:

It is not good practice to store multiple values in a single column. If you need to do this though, then try this:
SELECT adress,
       num,
       Stuff((SELECT ',' + ColumnA + ',' + ColumnB
              FROM   table1 a
              WHERE  a.Num = b.Num
              FOR xml path('')), 1, 1, '')
FROM   table1 b
GROUP  BY num 

