Eliminating duplicate rows by comparing values in different cells

Hi all,

as part of my workflow, I merged 4 different datatables into one single datatable. There could be duplicate rows in the merged datatable. Sample screenshot is below.
The order number will be populated in one and not the other between the duplicated rows. The client dispute id, invoice number and disputed amount are the common values between each set of duplicated rows.
my requirement is if client dispute id, invoice number and dispute amount are the same between any two rows, the one that doesn’t have the order number must be deleted.
I am not sure how to go about this scenario. can anyone suggest ways to go about doing this.


Thank you,

@parimala.prata, hey man, is there a reason why you did not compare the data tables before you merge them together?

The data is not redundant within the data tables themselves. When i combine all datatables together, the duplicity occurs.

Also, i was thinking if there is a way to identify the duplicates under the invoice number column and remove that row. this could also work for my scenario.

Have a Look Here
Linq query to identify duplicates and delete both entries - #3 by ppr

And Here

I tried the third scenario where it will keep all rows and remove the first duplicate. Getting an error. Do i have to install any packages?

thank you,

Nö additional package IS needed. Linq should be in the imporzed namespace. But in such a Case Always refer to running Demo.
From d in dt.asenunerable is needed

it was my fault. didn’t include a opening bracket. this time i am getting another error.


As in the running Demo the used variable is of datatype Datatable IT has the Method asenumerable

The Same IS required in your Implementation. In Case of there is an issue with Import of the datasetextensions into the namespaces have a Look Here


Hello ppr,

thank you for your assistance. I had to add the assembly reference to fix the issue. The initial piece of code you provided worked like a charm.

This community is awesome…Lots of experts actively engaging on the forum and helping people resolve their issues. Also the trove of knowledge that is shared through the forms is awesome. Extremely helpful.

Thank You,

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