How to return concatenated strings with a query
-
Thursday, February 07, 2008 5:24 AM
Let's say I have this relationship: A Person has zero or many Aliases. How can I query the database to return a set of Persons with all their Aliases concatenated as a single string?
For instance, if Peter's aliases are "Pedro", "Simon", "Simeon" and "Pete", I'd like to return the following:
"Pedro, Simon, Simeon, Pete"
I know I can query for the list of Aliases and concatenate them locally, but I'd rather do it in the query. Is this possible? I was thinking of writing a custom Aggregate(), Is that the way to go?

