Concatenate the datatable row values using linq

I have the below input table and I want to get the output as below using linq. Your support is much appreciated. Thanks.
Output should only be in two rows with unique names and work details should be concatenated in the same cell but in the new line.

Input Datatable :
Name Work
Ram Tester
Ram Developer
Ram Devops
John SM
John Tester

Output -
Name work
Ram Developer
John SM


Assign activity:
outputTable = (From row In inputTable.AsEnumerable()
Group row By Name = row(“Name”) Into Group
Let workDetails = String.Join(Environment.NewLine, Group.Select(Function(g) g(“Work Details”).ToString()))
Select outputTable.Rows.Add({Name, workDetails})).CopyToDataTable

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.