Return columns as comma separated, for more than one condition on key or more than one row

Solution 1:

SELECT t1.Key1, t1.Key2, 
       STUFF((SELECT ', ' + ColumnKey
                  FROM Table1 t2
                  WHERE t2.Key1 = t1.Key1
                      AND t2.Key2 = t1.Key2
                  ORDER BY ColumnKey
                  FOR XML PATH('') ),1,2,'') AS TColumnKey
    FROM Table1 t1
    GROUP BY t1.Key1, t1.Key2;