Hi team, Pls provide logic for this problem.Tq

Name Badges country
Gunawardhan 2 India
John skeeth 1 Uk
Sreekanth 1 India
Gunawardhan 3 India
Kleeda 4 Germany
John skeeth 3 Uk

From the table i need to write data in this manner
Name= Gunawadhan
Badges=5
Country=India

Name= John skeeth
Badges=4
Country=UK

Name= Sreekanth
Badges=1
Country=India

If names are duplicated i need Sum Badges. Pls provide logic.Tq

we can take it as a Group by case:

Assign Activity
dtResult = dtOrig.Clone

Assign Activity
dtResult =

(From d in dtOrig.AsEnumerable
Group d by k1=d("Name").toString.trim, k2=d("country").toString.trim into grp=Group
Let sm = grp.Sum(Function (x) CInt(x("Badges").toString.Trim))
Let ra = new Object(){k1,sm,k2}
Select r = dtResult.Rows.Add(ra)).CopyToDataTable

from dtResult we can generate any other format / representation

Also have a look here for Non-LINQ. LINQ Approaches

Hi @Lokesh_M2

If you want the Data with String type u can use below expression

(From row In dt1
Group row By name = row(“Name”).ToString Into Group
Let badges = Group.Sum(Function(r) Convert.ToInt32(r(“Badges”)))
Select “Name=” & name & Environment.NewLine & “Badges=” & badges.ToString & Environment.NewLine & “Country=” & Group.First()(“Country”).ToString & Environment.NewLine).Aggregate(Function(x,y) x & y)

Thanks you
VP