yup..see below--test tablecreate table test1(c1 char(1), c2 varchar(5))insert into test1select 'A','2ZS'UNION ALLSELECT 'A','RRT'UNION ALLSELECT 'A','ABC'UNION ALLSELECT 'B','22R'UNION ALLSELECT 'B','123'UNION ALLSELECT 'C','WWW'--udf to concat valuesCREATE FUNCTION ConcatValues(@c1 char(1))RETURNS varchar(8000)ASBEGINDECLARE @ret varchar(8000)SELECT @ret=COALESCE(@ret+',','') + c2FROM test1WHERE c1=@c1RETURN @retEND--the solution using call to above udfSELECT DISTINCT c1,dbo.ConcatValues(c1) AS ValListFROM test1--remove table created after testdrop table test1output-------------------------------c1 ValListA 2ZS,RRT,ABCB 22R,123C WWW
------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/