Get distinct rows

Hello Robochamps,

Can somebody help me to how to get distinct rows from a given datatable for ex. if their is a datatable named DT1 then i want to get all the distinct rows from table DT1

thanks!!

1 Like

Hi @Shikhar_Tandon

Use below code to get distinct rows in a column
dataTable.DefaultView.ToTable(True, <columnName>)

1 Like

Hi
here you go with all expressions that we can use for datatable

Cheers @Shikhar_Tandon

1 Like

hi @aanandsanraj, this will only give me the specific distinct column i want all the distinct rows.

Hi @Shikhar_Tandon

1.Use Remove Duplicate Rows Activity in properties pass input Datatable and create output
DataTable variable.
2.Use DataTable.DefaultView.ToTable(True,“ColumnName”).

Regards,
Kommi Jeevan.

1 Like

@Shikhar_Tandon Then try this code
dt.AsEnumerable().Distinct().CopyToDataTable()

Thanks @Palaniyappan got a lot of help from this.

1 Like

Cheers @Shikhar_Tandon
kindly let know for any queries or clarification