selecttype,user_name= (stuff((select ',' + name from tableName where type= a.type for xml path('')),1,1,''))
from tableName a group by type
Similar as Alias --user_name
--name need to integrate database information into a field
--tableName table name
--type group field
Reproduced in: https: //www.cnblogs.com/xy0710/p/11053288.html