(From d In dtInputData
Group d By k=d("Col1").toString.Trim Into grp=Group
Let dpr = (grp.Count = 1)
Let mba = grp.Select(Function (x,i) k & (i+1).toString).Cast(Of Object).toArray
Let nraa = If(dpr, New Object(){k},mba)
From ra In nraa
Select r=dtOutputData.Rows.Add(ra)).CopyToDataTable
2 Likes