I need to group items together where two or more fields match each other. I am not exactly sure how to accomplish this.
Here’s some example data:
TIME | TITLE | CHANNEL
---------+-------------------------+---------------
10:00 | Liverpool-Manchester | Viasat
10:00 | Liverpool-Manchester | Viasat HD
10:00 | Bla-debla | OtherChannel
10:00 | team1-team2 | SomeChannel
10:00 | team1-team2 | SomeChannel HD
I want to group items where TIME and TITLE match. Like below.
First grouped items:
10:00 | Liverpool-Manchester | Viasat
10:00 | Liverpool-Manchester | Viasat HD
Second grouped items:
10:00 | Bla-debla | OtherChannel
Third grouped items:
10:00 | team1-team2 | SomeChannel
10:00 | team1-team2 | SomeChannel HD
Any idea how to accomplish this?
Try the following please:
from c in collectiongroup c.Title by new {c.Title,c.Time} into t
where t.Count()>1
select t;
You will need to introduce new anonymous type if you want to group by more than one property and specify the properties in there
Not tested but should work.