Combine row with similar data

Hi
I have one table like


I wanted to combine the rows into one single row if it has different value in it’s value I want to merge that.
I used on query but resulted into two rows(when it has more column)
Can anyone help me to merge it into one single row based on id.

@Nisha_K21,

Try this solution.

Thanks,
Ashok :slightly_smiling_face:

@ashokkarale, I tried this solution, this will merge rows but when we have more columns this will result in two rows with merged values. Is there any other way to do this.

just share samples as descriptions is too general

Kindly note

  • we can also group data by more then one column
  • we can also define more then one group member aggregations

Example: grouping on id And name, concatenation of the tokenNames

Assign Activity
dtResult | DataType: DataTable = dtOrigVar.Clone

Assign Activity
dtResult =

(From d in dtOrigVar.AsEnumerable
Group d by k1=d("id").toString.Trim, k2=d("name").toString.Trim into grp=Group
let ra1 = grp.First().ItemArray.SkipLast(1).Cast(of Object)
Let tj = String.Join(",", grp.Select(Function (g) g("tokenName"))
Let ra = ra1.Append(tj).toArray
Select r = dtResult.Rows.Add(ra)).CopyToDataTable

this was done there

unclear, just share clear descriptions

  • input sample
  • expected output sample