Hi!
How with LINQ I can update my datatable, combine values in one column.
Combine col2 by meaning col1.
Such datatable:
Must be:
give a try on:
(From d In dtData.AsEnumerable
Group d By k=d("Col1").toString.Trim Into grp=Group
Let agg = String.Join(";", grp.Select(Function (x) x("Col2").toString))
From g In grp
Order By dtData.Rows.IndexOf(g)
Let ra = New Object(){g(0),agg,g(2), g(3)}
Select dtResult.Rows.Add(ra)).CopyToDataTable
Input / Output
Find starter help here:
GroupBy_1Col_SetStringConcatToAll.xaml (8.6 KB)
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.