my table commadate having below data
id name add dateEnterd
1 ab test 1988-08-23
1 ab test 1989-08-23
1 ab test 1990-08-23
1 ab test 1991-05-01
SELECT ROW_NUMBER() OVER(order by dateEnterd asc)as ID,dateEnterd INTO #TempcomDate
FROM commadate
DECLARE @SR INT
DECLARE @ID INT
DECLARE @strDate NVARCHAR(MAX)
SET @SR=1
SET @ID=(SELECT MAX(ID) FROM #TempcomDate)
SET @strDate=''
WHILE(@SR<=@ID)
BEGIN
IF(@SR>1)BEGIN SET @strDate+=',' END
SET @strDate+=CONVERT(NVARCHAR(50), (SELECT dateEnterd FROM #TempcomDate WHERE ID=@SR))
SET @SR=@SR+1
END
SELECT DISTINCT id,name,[add],@strDate AS dateEnterd from dbo.commadate
DROP TABLE #TempcomDate
O/P
id name add dateEnterd
1 ab test 1988-08-23,1989-08-23,1990-08-23,1991-05-01