Keep structure of table as it is and take distinct row

Hi All,

Below is my table structure after merging data now i want to remove duplicates from data which i am having in one data table using customer number, company code and frequency columns and want to keep all table structure as it is, please help it urgent.

Hi @amruta_pawar

dt1 = dt.DefaultView.ToTable(true, “customer number”, “company code”,“frequency”)

this giving me data as 12345,2290,Custom two times, but i want only one row with all other columns.

May be LINQ can help but i am not good at this so needing help in that.

Check this linq, @amruta_pawar
dataTable new_dt =
old_dt.AsEnumerable().GroupBy(Function(i) i.Field(Of String)(“columnWithDuplic”)).Select(Function(g) g.First).CopyToDataTable

can you please tell me with my columns , it will be great help.

dataTable new_dt =
old_dt.AsEnumerable().GroupBy(Function(i) i.Field(Of String)(“customer number”) and i.Field(Of String)(“company code”) and i.Field(Of String)(“frequency") ).Select(Function(g) g.First).CopyToDataTable

getting error as below,

Don’t just copy paste the linq query, change the double quotes and your datatable at the beginning of linq query.
If possible send me your workflow and the file.

Check this input, output and workflow,
Ouput_Data.xlsx (7.3 KB) SampleSequence.xaml (12.8 KB) Input file.xlsx (18.6 KB)

hi buddy this giving me data from first dt i want output data from result dt