Distinct Rows from a data table


How can i overcome with the following problem.

I am having a datatable with 5 columns say A to E columns and N no of rows.


  1. Column A has unique value.

  2. If B to E column has same set of row data i want to conisder it as single row.
    eg: if first 3 rows of data from the column B to E is same we can conisder it has single datarow along with column A data which will be unqiue, so two data will be present for column A along with matching results.

  3. If there is different row data for the columns B to E i want to leave it and consider it as different rows.


1 Like

You can use the following expression and get the unique values based on columns from B to E

outputDataTable = InputDatatable.DefaultView.ToTable(False,“B”,"C","D","E")

Karthik Byggari

1 Like

No I just want to check the second row if not 3rd, if it matches we need to combine both the rows and consider as single row.

DT1 = DT.AsEnumerable().GroupBy(Function(a) a.Field(Of String)(1)).Select(Function(b) b.First).CopyToDataTable()

try thatDuplicate Row Data.zip (7.6 KB)


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