Get unique values by multiple columns in datatable

I have excel file with 290000 records and columns count is 19.
I read it in datatable.
I have to get all records that are duplicated in columns index 0,1,5,6,8,9,16.
I use in List:
IDList = dt.AsEnumarable.Select(function(row) row(0)+";"+row(1)+";"+…+row(16)).ToList()
IDDubl = IDList.Distinct().Where(function(item) IDList.LastIndexOf(item) <> IDList.IndexOf(item) ).ToList()
And then in for each I write comment in DT what is this double at each records in IDDubl
But it work very very long.

What other method can I use?

Hi @Aleksey_M

Could you please try the below query, this will only give the duplicate records from the columns

(From g In YourDt
Group g By a1=g(“ColumnName\Index”).tostring.trim, a2=g(“ColumnName\Index”).tostring.trim Into grp=Group
Where grp.count > 1
Select grp.tolist).selectmany(Function (x) x).copytodatatable

Feel free add as many columns you want in the query.

What do they mean a1,a2 ? Variables?

@Aleksey_M - Those are just reference, like when you use join query in SQL you name it as a and b right…similar to that…

You can refer this post…

Thank’s! Yes it works fast.
But next problem its update column Comment in DT with 290000 records.
I find 440 dublicate and in for each row in DT I do LINQ Select from dt_dubl and if find record I update column Comment.
But it work very very long too.