Home Forums SQL Server 2008 T-SQL (SS2K8) Convert values of mulitiple rows into single column with no duplicate entries RE: Convert values of mulitiple rows into single column with no duplicate entries

  • the solution is to convert the column to varchar and run that inside subquery, hope it will help some one else with similar problem, now one more thing here left is the order of entries.

    SELECT a.Province ,a.District ,

    FPS =

    (select stuff((SELECT distinct ',' + cast(fp as varchar(10))

    FROM #Result t2

    where t2.Province = a.province and

    t2.district=a.district

    FOR XML PATH('')),1,1,''))

    FROM #Result a

    GROUP BY a.Province,a.district