So I have two DbSets worth of data, let's call them A and B. I want to join these together on two fields. I have that statement no problem. Once the two data sets are joined I get a distinct set or rows. Lastly, and this is the part I need help with, I need to find all rows where all fields are the same, except one column, and that column needs to be combined into a comma separate list.
Columns: Field1, Field2, Field3, Field4, Field5
Data Row 1: A, Apple, 1, 2, 3
Data Row 2: A, Orange, 1, 2, 3
Data Row 3: A, Cherry, 3, 2, 1
The data above is already joined and has distinct values. The code I need takes this data and outputs the following:
Columns: Field1, Field2, Field3, Field4, Field5
Data Row 1: A, [Apple, Orange], 1, 2, 3
Data Row 2: A, Cherry, 3, 2, 1
When the data in Field1, 3, 4, and 5 are the same I need to join all the items in Field2 into a comma separated string or List, ideally. I should also note that currently the data rows are an anonymous type.
Any ideas?