How to update one column based on other column

Hi

I have a scenario my input Datatable is as below

Ram Good
Shyam Nice
Bheem Marvelous
Bheem Good

Output datatable is:

Ram Good
Shyam Nice
Bheem
Bheem Marvelpous,Good

Hi @karthik_kulkarni1

Try this

(From row In DT.AsEnumerable()
            Group row By Key = row.ItemArray(0) Into Group
            Let Status = If(Group.Count() > 1, String.Join(",", Group.Select(Function(r) r.ItemArray(1))), If(Group.Count() = 1, Group.First().ItemArray(1).ToString(), ""))
            Select DT.Clone.Rows.Add(Key, Status)).CopyToDataTable()

Cheers!!

1 Like

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