Need Help with a select statement

  • Assuming you're using SQL Server 2005

    SELECT

    a.Acct_ID,

    STUFF((SELECT ','+f.FlagTitle AS "text()"

    FROM Flags f

    WHERE a.Acct_ID = f.Acct_ID

    ORDER BY f.FlagTitle

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

    FROM Accounts a

    ____________________________________________________

    Deja View - The strange feeling that somewhere, sometime you've optimised this query before

    How to get the best help on a forum

    http://www.sqlservercentral.com/articles/Best+Practices/61537

Viewing post 1 (of 2 total)

You must be logged in to reply to this topic. Login to reply