You can use the XML PATH method like shown belowSELECT x1.nomer, STUFF(x2.tanggal,1,1,'') AS tanggalFROM (SELECT DISTINCT nomer FROM x1) AS x1 CROSS APPLY ( SELECT ','+CAST(DAY([tgl]) AS VARCHAR(2)) FROM x1 x2 WHERE x2.nomer = x1.nomer FOR XML PATH('') ) x2(tanggal);
And this is a blatant and shameless attempt to plug a blog: ------------------------------------------------------------------------------------------------------SQL Server SSBhttp://myshallowsqlblog.wordpress.com/the-lowdown-on-that-xml-path-thingie/