• Tweaking Alan's code, I can reduce the reads by half by reducing the length of the code. 🙂

    WITH uqvals AS

    (

    SELECT ID,

    MIN(DateOpen) DateOpen,

    MAX(DateClose) DateClose

    FROM @table

    GROUP BY ID

    )

    SELECTID,

    [Desc] = REPLACE(REPLACE((SELECT '|'+[desc]+'|' FROM @table t WHERE uv.ID = t.ID FOR XML PATH('')),'||',','),'|',''),

    DateOpen,

    DateClose

    FROM uqvals uv;

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2