Remove all of Duplicate Rows base on Single Column

Hi Everyone.

I want to remove all of duplicate rows ( not keep any duplicate row ) base on single column from datatable.

How to do that with linQ ?

Thanks in advance!

Hi @Mr.H ,

ExtractDataTable.DefaultView.ToTable(True,“ColumnName”)

Cheers

Hi Bro.

I send the sample files as attached
Input.xlsx (8.1 KB)
Output.xlsx (8.0 KB)

(From d in YourDataTableVar.AsEnumerable
Group d by k=d(YourColNameOrIndex).toString.Trim() into grp=Group
Where grp.Count = 1
Select grp.ToList).SelectMany(Function (x) x).CopyToDataTable

Handling defensive an empty result following pattern can be applied:

Thanks you Very much!

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