Given a table like
ID | Name | City
1 | X | Y
2 | Z | Y
3 | W | K
I want to produce a result like
ID | Description
1 | Y (X, Z)
3 | K (W)
I tried something like
From C In Clients Group C By C.ID, C.City _
Into G = Group Select New With {.ID = ID, .Description = City & _
" (" & (From C In Clients Select C.Name).Aggregate(Function(X, Y) X & ", " & Y) & ")"}
Which gave me an error “The query operator ‘Aggregate’ is not supported.”
Also tried
From C In Clients Group C By C.ID, C.City _
Into G = Group Select New With {.ID = ID, .Description = City & _
" (" & String.Join((From C In Clients Select C.Name).ToArray, ", ") & ")"}
Which gave me the error “no supported translation to SQL”
So, how can i do this?
I hacked this in C# and it seems to give what you want. I’ll leave the translation to VB up to you.