• it's not obvious where the alias goes;

    here's two examples:

    SELECT POPRCTNM,

    STUFF((SELECT ','+ CAST(ACTINDX AS varchar)

    FROM POP30390 a

    WHERE a.POPRCTNM = d1.POPRCTNM

    GROUP BY a.ACTINDX

    FOR XML PATH(''), TYPE).value('.','VARCHAR(max)'), 1, 1, '')

    AS AliasForStuff

    FROM POP30390 d1

    SELECT POPRCTNM,

    AliasForStuff = STUFF((SELECT ','+ CAST(ACTINDX AS varchar)

    FROM POP30390 a

    WHERE a.POPRCTNM = d1.POPRCTNM

    GROUP BY a.ACTINDX

    FOR XML PATH(''), TYPE).value('.','VARCHAR(max)'), 1, 1, '')

    FROM POP30390 d1

    Lowell


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!