try this:create table test123(name char(1),date smalldatetime,location varchar(10))insert into test123select 'A', '2010/07/07', 'usa' union allselect 'B', '2010/07/07', 'usa' union allselect 'C', '2010/07/07', 'usa'select date,location,stuff((select ',' + a.name from test123 as a where a.date = b.date and a.location = b.location order by a.name for xml path('')),1,1,'') as [all] from test123 as bgroup by date, locationorder by date, location