• This is great! I have been using the Coalesce function in a udf for this purpose, but this method is faster. I didn't use it as a correlated subquery, but I did replace the internals of my udf with the "For XML PATH" and it took a 3 second query for 10,000 records down to 1 second.

    Thank you!