Linqtosql - joined rows

In Linqtosql how do I show items from multiple rows in a single field.

eg I have a 3 table setup for tagging(entity, tag, entitytag) all linked via foreign keys.

For each entity I would like to return the name in one field and then all relevant tags in 2nd field.

eg Item1, tag1; tag2; tag3 Item2, tag4, tag5....

VB statements preferred.

Thanks Geoff

Answers


Okay, not sure if this is the most efficient way but it works.

Dim dc As New DataContext

Dim query = From i In dc.Items _
            Let tags = (From t In dc.ItemTags _
                        Where t.ItemID = i.ID _
                        Select t.Tag.Name).ToArray _
            Select i.ItemName, Tags = String.Join(" | ", tags)

Need Your Help

To split Strings from a MultiAutoCompleteTextView and set it to different textview

android textview multiautocompletetextview

I have a array of strings which is a resultant of options selected from a MultiAutoCompleteTextView using the comma tokenizer. The string appears as below: