• I am not sure what the execution times for the following query would be as I have not implemented any hints or indexes on the temp table created however probably you can give this a shot (The only time lag here would actually be the replace statements as mentioned below.... try it out an let me know :w00t: )

    select reportid,replace(replace(Val,'<User2>',''),'</User2>','')

    from

    (select distinct a.reportid,

    --(select top 1 User2 from #tbl b where b.reportid=a.reportid) as Test,

    (select distinct User2+' ' from #tbl c where c.reportid = a.reportid FOR XML PATH('')) as Val

    from #tbl a) x

    This would give you the following result:-