Select Distinct and obtain all row of it


Hello guys,

Basically I have a table with more than 10 columns and the first row has Employee Numbers.

I want to do a Select Distinct by Employees numbers to remove duplicates and then I want to keep all values That are from the resulting filtered Employees numbers, meaning I want to keep all row and matching values of the remaining columns.

Can you please help me?

Remove Duplicate Entries with exception of the first one

HI @mikePontes,

Please refer below link.



Hello arivu,

But its not a filter That I want.

Its simply to remove all duplicates and by That not having 3 or 4 rows with the same Employee Number



You can try using following query in assign activity,
Datatable dt = Datatable.DefaultView.Totable(true, list of column names)

Dominic :slight_smile:

How to distinct the excel

I tried a similar solution, but That way only returns the column of Employees Number in this case right? It Will do a Select Distinct in That column, but I Will not have the values of the other ones.


@mikePontes, you can give all the column names to achieve it separated by commas or to be precise assign the column names to array or list and use the variable there.

Dominic :slight_smile:


So if I have:

Column A Column B
1 jose
1 jose
1 jose
2 Mario
3 Paula

IT Will return:

Column A Column B
1 jose
2 Mario
3 Paula

Its like That?

Best Regards,

Miguel Pontes


@mikePontes, Exactly.

Dominic :slight_smile:


I Will try than!

Many thanks mate.

Best Regards


@mikePontes, Pleasure to help. Let me know if u have any concern.

Dominic :slight_smile:


Just clarifying things in a more clear way so it will be easy for Beginner level users :slight_smile:

dataTable.DefaultView.ToTable(true, “Column1”)


DataView view = new DataView(table);
DataTable distinct_Values = view.ToTable(true, “Column1”, “Column2” …);


  • First parameter in ToTable() is a boolean which indicates whether you want distinct rows or not.

  • Second parameter in the ToTable() is the column name based on which we have to select distinct rows.

Only these columns will be in the returned datatable.


How to Remove Duplicate Columns in Excel and have the distinct values in the other sheet