Delete duplicate row and original rows that duplicated

Hi there,

I’m trying to delete the duplicate rows.

while using ‘remove duplicate rows’ remains the single original rows…

I want to delete that original rows too… if it is duplicated.

For Example.

Column A contains { 1, 1, 1, 1, 1, 1, 11, 11, 111 } then output should only { 111 }


Can you try the following expression?

dt.AsEnumerable.GroupBy(Function(r) r("Column A").ToString).Where(Function(g) g.Count=1).SelectMany(Function(g) g).CopyToDataTable

The above check duplicated value of ColumnA.


1 Like

HI @Peace_Maker

How about this expression?

(From d In Dt1.AsEnumerable
Group d By k=d("Column A").toString.Trim Into grp=Group
Where grp.Count = 1
From g In grp
Order By Dt1.Rows.IndexOf(g)
Select r=g).CopyToDataTable

Check out the XAML file

DuplicateRemove.xaml (7.3 KB)




1 Like

Thank you!!!

it is work for me~~ :slight_smile:

1 Like

Thank you!

your code is work fine too~~

1 Like

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