Concatenate column values for rows with the same values (of different columns)
SQL Server 2005 I have a table which returns ID name prop value -------------------------- 1 one Prop1 a 1 one Prop1 b 1 one Prop2 c 2 two Prop1 d 2 two Prop2 e How can I run a select on it to return ID name prop value ----------------------------- 1 one Prop1 a,b 1 one Prop2 c 2 two Prop1 d 2 two Prop2 e try this: --Concatenation with FOR XML and eleminating control/encoded character expansion "& < >" set nocount on; declare @YourTable table (RowID int, RowName varchar(5), prop varchar(5), RowValue varchar(5)) insert into @YourTable VALUES (1,'one','Prop1','a') insert into @YourTable VALUES