Filtering a data table for duplicate column values

Hey @FireflySeason2

you can do using Datatables

Datatable DuplicateResults =  YourDatatableName.AsEnumerable.GroupBy(function(x) x("YourColumnName i.e Column3")).Where(function(x) x.Count() > 1).SelectMany(function(g) g).ToArray().CopyToDatatable;

Datatable UniqueRecords = YourDatatableName.AsEnumerable().GroupBy(Function(x) x("YourColumnName i.e Column3")).Where(Function(x) x.Count = 1).SelectMany(Function(x) x).ToArray.CopyToDataTable;

See my attached Sample for your better understanding and reference :slight_smile:
ColumnDuplicateSample.xaml (8.6 KB)

Regards…!!
Aksh

7 Likes